feedback.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. 欢迎光临!各位梅山古镇的顾客朋友们,为了提供更优质的产品和更好的服务给你们,向各位征集对本公司的评价、期望、意见和建议,非常期待你们的反馈。我们将会报以更优质的服务。谢谢您的协助和厚爱。评价,建议一经公司评选和采纳,会有丰厚奖品赠送哦,赶快来参加吧!
  35. </view>
  36. <view class="from">
  37. <view class="filter-btn-group">
  38. <view class="row-text">留言类型:</view>
  39. <view v-for="(item, idx) in filterOptions" :key="idx"
  40. :class="['filter-btn', filterStatus === item.value ? 'active' : '']"
  41. @click="onFilterChange(item.value)">
  42. {{ item.label }}
  43. </view>
  44. </view>
  45. <u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
  46. <u-form-item label="留言人姓名:" prop="userInfo.name" ref="item1">
  47. <u--input v-model="model1.userInfo.name" border="none"></u--input>
  48. </u-form-item>
  49. <u-form-item label="联系电话:" prop="userInfo.tel" ref="item1">
  50. <u--input v-model="model1.userInfo.tel" border="none"></u--input>
  51. </u-form-item>
  52. <u-form-item label="E-mail:" prop="userInfo.mail" ref="item1">
  53. <u--input v-model="model1.userInfo.mail" border="none"></u--input>
  54. </u-form-item>
  55. <u-form-item label="留言:" ref="item1">
  56. <u--textarea v-model="model1.userInfo.liuyan" border="none"></u--textarea>
  57. </u-form-item>
  58. </u--form>
  59. </view>
  60. </view>
  61. <view class="return_view">
  62. <view class="return-button" @click="goBack">返回</view>
  63. </view>
  64. </view>
  65. <u-toast ref="uToast"></u-toast>
  66. </view>
  67. </template>
  68. <script>
  69. import {
  70. feed
  71. } from '@/api/scan'
  72. export default {
  73. data() {
  74. return {
  75. scanCode: '',
  76. filterStatus: '2',
  77. filterOptions: [{
  78. label: '意见反馈',
  79. value: '1'
  80. },
  81. {
  82. label: '留言评价',
  83. value: '2'
  84. }
  85. ],
  86. model1: {
  87. userInfo: {
  88. qrCode: '',
  89. type: '',
  90. liuyan: '',
  91. tel: '',
  92. mail: '',
  93. name: ''
  94. },
  95. },
  96. rules: {
  97. 'userInfo.name': {
  98. type: 'string',
  99. required: true,
  100. message: '请填写姓名',
  101. trigger: ['blur', 'change']
  102. },
  103. 'userInfo.tel': [{
  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. openDetail() {
  133. uni.navigateTo({
  134. url: '/pages/cjx/index/rules'
  135. });
  136. },
  137. goBack() {
  138. uni.navigateBack();
  139. },
  140. onFilterChange(val) {
  141. if (this.filterStatus !== val) {
  142. this.filterStatus = val;
  143. }
  144. },
  145. saveData() {
  146. let that = this;
  147. this.model1.userInfo.type = this.filterStatus;
  148. this.$refs.uForm.validate().then(res => {
  149. feed(that.model1.userInfo).then(data => {
  150. this.model1.userInfo.liuyan = '';
  151. this.model1.userInfo.tel = '';
  152. this.model1.userInfo.mail = '';
  153. this.model1.userInfo.name = '';
  154. let params = {
  155. type: "success",
  156. title: "成功主题(带图标)",
  157. message: "提交成功",
  158. iconUrl: "https://uviewui.com/demo/toast/success.png",
  159. }
  160. this.$refs.uToast.show({
  161. ...params
  162. });
  163. })
  164. }).catch(errors => {
  165. })
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. @import url('../../../static/scss/common_cjx.css');
  172. .row-class {
  173. height: 80rpx;
  174. }
  175. .cardTop{
  176. background-image:
  177. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/yjfk.png");
  178. }
  179. .theme-text {
  180. height: 10vh;
  181. text-align: center;
  182. line-height: 11vh;
  183. .textImage {
  184. height: 80rpx;
  185. width: 400rpx;
  186. }
  187. }
  188. ::v-deep .u-form-item__body__left {
  189. width: 160rpx !important;
  190. }
  191. ::v-deep .u-form-item__body__left__content__label {
  192. font-weight: bold;
  193. font-size: 26rpx !important;
  194. color: #FFFFFF !important;
  195. }
  196. ::v-deep .u-form-item__body__right {
  197. border: 1px solid #DE00FF !important;
  198. }
  199. ::v-deep .u-textarea {
  200. background-color: rgba(0, 0, 0, 0) !important;
  201. }
  202. ::v-deep .u-form-item__body {
  203. display: flex;
  204. flex-direction: row;
  205. padding: 0 0 !important;
  206. padding-top: 10rpx !important;
  207. }
  208. ::v-deep .u-form-item__body__right__message {
  209. margin-left: 160rpx !important;
  210. }
  211. .filter-btn-group {
  212. display: flex;
  213. justify-content: flex-start;
  214. align-items: center;
  215. gap: 24rpx;
  216. margin: 10rpx 0 10rpx 0;
  217. }
  218. .filter-btn {
  219. padding: 4rpx 20rpx;
  220. border: 2rpx solid #DE00FF;
  221. color: #DE00FF;
  222. font-size: 28rpx;
  223. transition: all 0.2s;
  224. margin-left: 10rpx;
  225. }
  226. .filter-btn.active {
  227. background: #DE00FF;
  228. color: #fff;
  229. border: 2rpx solid #DE00FF;
  230. }
  231. .row-text {
  232. font-weight: bold;
  233. font-size: 26rpx;
  234. color: #FFFFFF;
  235. }
  236. .content {
  237. height: 69vh;
  238. overflow: auto;
  239. margin: 0 32rpx;
  240. padding: 32rpx 24rpx 24rpx 24rpx;
  241. background-image:
  242. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/cardBgi.png");
  243. background-size: cover;
  244. background-position: center;
  245. background-repeat: no-repeat;
  246. }
  247. .savaBtn {
  248. margin-top: 10px;
  249. font-weight: 600;
  250. }
  251. .intro-content {
  252. font-weight: 500;
  253. font-size: 28rpx;
  254. color: #F5F5F5;
  255. }
  256. </style>