feedback.vue 6.8 KB

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