feedback.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="intro-page common">
  3. <view class="top-class"></view>
  4. <view class="title">
  5. 意见反馈
  6. </view>
  7. <view class="head">
  8. <u-row class="row-class">
  9. <u-col span="4">
  10. <image class="logo-img"
  11. src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/logo.png"
  12. mode="aspectFit" />
  13. </u-col>
  14. <u-col span="4">
  15. <image class="commodity-img"
  16. src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/commodity.png"
  17. mode="aspectFit" />
  18. </u-col>
  19. <u-col span="4">
  20. <image class="logo-rules"
  21. src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/rules.png"
  22. @click="openDetail" />
  23. </u-col>
  24. </u-row>
  25. </view>
  26. <view class="topImg">
  27. <image class="img_1" src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/topImg.png"
  28. mode="heightFix" />
  29. </view>
  30. <view class="content">
  31. <view class="cardTop"></view>
  32. <view class="content_text">
  33. <view class="intro-content">
  34. <view> 超吉炫低纤槟榔胶果消费者反馈表 </view>
  35. <view> 亲爱的消费者: </view>
  36. <view> 感谢您选择超吉炫低纤槟榔胶果!为了能给您带来更优质的产品和服务体验,我们诚挚地邀请您填写这份反馈表。您的宝贵意见对我们至关重要,我们会认真对待每一条反馈。若您的建议被采纳,将有机会获得超吉炫精心准备的礼品哦!
  37. </view>
  38. </view>
  39. <view class="from">
  40. <view class="filter-btn-group">
  41. <view class="row-text">留言类型:</view>
  42. <view v-for="(item, idx) in filterOptions" :key="idx"
  43. :class="['filter-btn', filterStatus === item.value ? 'active' : '']"
  44. @click="onFilterChange(item.value)">
  45. {{ item.label }}
  46. </view>
  47. </view>
  48. <u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
  49. <u-form-item label="留言人姓名:" prop="userInfo.name" ref="item1">
  50. <u--input v-model="model1.userInfo.name" border="none" color="#fff"></u--input>
  51. </u-form-item>
  52. <u-form-item label="联系电话:" prop="userInfo.tel" ref="item1">
  53. <u--input v-model="model1.userInfo.tel" border="none" color="#fff"></u--input>
  54. </u-form-item>
  55. <u-form-item label="E-mail:" prop="userInfo.mail" ref="item1">
  56. <u--input v-model="model1.userInfo.mail" border="none" color="#fff"></u--input>
  57. </u-form-item>
  58. <u-form-item label="留言:" ref="item1">
  59. <u--textarea v-model="model1.userInfo.liuyan" border="none" color="#fff"></u--textarea>
  60. </u-form-item>
  61. </u--form>
  62. </view>
  63. </view>
  64. <view class="return_view" style="justify-content: space-around;">
  65. <view class="return-button" @click="saveData">保存</view>
  66. <view class="return-button" @click="goBack">返回</view>
  67. </view>
  68. </view>
  69. <u-toast ref="uToast"></u-toast>
  70. </view>
  71. </template>
  72. <script>
  73. import {
  74. feed
  75. } from '@/api/scan'
  76. export default {
  77. data() {
  78. return {
  79. scanCode: '',
  80. filterStatus: '2',
  81. filterOptions: [{
  82. label: '意见反馈',
  83. value: '1'
  84. },
  85. {
  86. label: '留言评价',
  87. value: '2'
  88. }
  89. ],
  90. model1: {
  91. userInfo: {
  92. qrCode: '',
  93. type: '',
  94. liuyan: '',
  95. tel: '',
  96. mail: '',
  97. name: ''
  98. },
  99. },
  100. rules: {
  101. 'userInfo.name': {
  102. type: 'string',
  103. required: true,
  104. message: '请填写姓名',
  105. trigger: ['blur', 'change']
  106. },
  107. 'userInfo.tel': [{
  108. required: true,
  109. message: '请输入手机号',
  110. trigger: ['change', 'blur'],
  111. },
  112. {
  113. // 自定义验证函数,见上说明
  114. validator: (rule, value, callback) => {
  115. console.log(value);
  116. // 上面有说,返回true表示校验通过,返回false表示不通过
  117. // uni.$u.test.mobile()就是返回true或者false的
  118. return uni.$u.test.mobile(value);
  119. },
  120. message: '手机号码不正确',
  121. // 触发器可以同时用blur和change
  122. trigger: ['change', 'blur'],
  123. }
  124. ],
  125. },
  126. }
  127. },
  128. onReady() { // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
  129. this.$refs.uForm.setRules(this.rules)
  130. },
  131. onLoad() {
  132. this.scanCode = uni.getStorageSync('scanCode');
  133. this.model1.userInfo.qrCode = this.scanCode;
  134. },
  135. methods: {
  136. openDetail() {
  137. uni.navigateTo({
  138. url: '/pages/cjx/index/rules'
  139. });
  140. },
  141. goBack() {
  142. uni.navigateBack();
  143. },
  144. onFilterChange(val) {
  145. if (this.filterStatus !== val) {
  146. this.filterStatus = val;
  147. }
  148. },
  149. saveData() {
  150. let that = this;
  151. this.model1.userInfo.type = this.filterStatus;
  152. this.$refs.uForm.validate().then(res => {
  153. feed(that.model1.userInfo).then(data => {
  154. this.model1.userInfo.liuyan = '';
  155. this.model1.userInfo.tel = '';
  156. this.model1.userInfo.mail = '';
  157. this.model1.userInfo.name = '';
  158. let params = {
  159. type: "success",
  160. title: "成功主题(带图标)",
  161. message: "提交成功",
  162. iconUrl: "https://uviewui.com/demo/toast/success.png",
  163. }
  164. this.$refs.uToast.show({
  165. ...params
  166. });
  167. })
  168. }).catch(errors => {
  169. })
  170. }
  171. }
  172. }
  173. </script>
  174. <style lang="scss" scoped>
  175. @import url('../../../static/scss/common_cjx.css');
  176. .row-class {
  177. height: 80rpx;
  178. }
  179. .cardTop{
  180. background-image:
  181. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/yjfk.png");
  182. }
  183. .theme-text {
  184. height: 10vh;
  185. text-align: center;
  186. line-height: 11vh;
  187. .textImage {
  188. height: 80rpx;
  189. width: 400rpx;
  190. }
  191. }
  192. ::v-deep .u-form-item__body__left {
  193. width: 160rpx !important;
  194. }
  195. ::v-deep .u-form-item__body__left__content__label {
  196. font-weight: bold;
  197. font-size: 26rpx !important;
  198. color: #FFFFFF !important;
  199. }
  200. ::v-deep .u-form-item__body__right {
  201. border: 1px solid #DE00FF !important;
  202. }
  203. ::v-deep .u-textarea {
  204. background-color: rgba(0, 0, 0, 0) !important;
  205. }
  206. ::v-deep .u-textarea__field{
  207. color:#fff !important;
  208. }
  209. ::v-deep .u-form-item__body {
  210. display: flex;
  211. flex-direction: row;
  212. padding: 0 0 !important;
  213. padding-top: 10rpx !important;
  214. }
  215. ::v-deep .u-form-item__body__right__message {
  216. margin-left: 160rpx !important;
  217. }
  218. .filter-btn-group {
  219. display: flex;
  220. justify-content: flex-start;
  221. align-items: center;
  222. gap: 24rpx;
  223. margin: 10rpx 0 10rpx 0;
  224. }
  225. .filter-btn {
  226. padding: 4rpx 20rpx;
  227. border: 2rpx solid #DE00FF;
  228. color: #DE00FF;
  229. font-size: 28rpx;
  230. transition: all 0.2s;
  231. margin-left: 10rpx;
  232. }
  233. .filter-btn.active {
  234. background: #DE00FF;
  235. color: #fff;
  236. border: 2rpx solid #DE00FF;
  237. }
  238. .row-text {
  239. font-weight: bold;
  240. font-size: 26rpx;
  241. color: #FFFFFF;
  242. }
  243. .content {
  244. height: 69vh;
  245. overflow: auto;
  246. margin: 0 32rpx;
  247. padding: 32rpx 24rpx 24rpx 24rpx;
  248. background-image:
  249. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/cardBgi.png");
  250. background-size: cover;
  251. background-position: center;
  252. background-repeat: no-repeat;
  253. }
  254. .savaBtn {
  255. margin-top: 10px;
  256. font-weight: 600;
  257. }
  258. .intro-content {
  259. font-weight: 500;
  260. font-size: 28rpx;
  261. color: #F5F5F5;
  262. }
  263. </style>