feedback.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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" color="#fff"></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" color="#fff"></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" color="#fff"></u--input>
  54. </u-form-item>
  55. <u-form-item label="留言:" ref="item1">
  56. <u--textarea v-model="model1.userInfo.liuyan" border="none" color="#fff"></u--textarea>
  57. </u-form-item>
  58. </u--form>
  59. </view>
  60. </view>
  61. <view class="return_view" style="justify-content: space-around;">
  62. <view class="return-button" @click="saveData">保存</view>
  63. <view class="return-button" @click="goBack">返回</view>
  64. </view>
  65. </view>
  66. <u-toast ref="uToast"></u-toast>
  67. </view>
  68. </template>
  69. <script>
  70. import {
  71. feed
  72. } from '@/api/scan'
  73. export default {
  74. data() {
  75. return {
  76. scanCode: '',
  77. filterStatus: '2',
  78. filterOptions: [{
  79. label: '意见反馈',
  80. value: '1'
  81. },
  82. {
  83. label: '留言评价',
  84. value: '2'
  85. }
  86. ],
  87. model1: {
  88. userInfo: {
  89. qrCode: '',
  90. type: '',
  91. liuyan: '',
  92. tel: '',
  93. mail: '',
  94. name: ''
  95. },
  96. },
  97. rules: {
  98. 'userInfo.name': {
  99. type: 'string',
  100. required: true,
  101. message: '请填写姓名',
  102. trigger: ['blur', 'change']
  103. },
  104. 'userInfo.tel': [{
  105. required: true,
  106. message: '请输入手机号',
  107. trigger: ['change', 'blur'],
  108. },
  109. {
  110. // 自定义验证函数,见上说明
  111. validator: (rule, value, callback) => {
  112. console.log(value);
  113. // 上面有说,返回true表示校验通过,返回false表示不通过
  114. // uni.$u.test.mobile()就是返回true或者false的
  115. return uni.$u.test.mobile(value);
  116. },
  117. message: '手机号码不正确',
  118. // 触发器可以同时用blur和change
  119. trigger: ['change', 'blur'],
  120. }
  121. ],
  122. },
  123. }
  124. },
  125. onReady() { // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
  126. this.$refs.uForm.setRules(this.rules)
  127. },
  128. onLoad() {
  129. this.scanCode = uni.getStorageSync('scanCode');
  130. this.model1.userInfo.qrCode = this.scanCode;
  131. },
  132. methods: {
  133. openDetail() {
  134. uni.navigateTo({
  135. url: '/pages/cjx/index/rules'
  136. });
  137. },
  138. goBack() {
  139. uni.navigateBack();
  140. },
  141. onFilterChange(val) {
  142. if (this.filterStatus !== val) {
  143. this.filterStatus = val;
  144. }
  145. },
  146. saveData() {
  147. let that = this;
  148. this.model1.userInfo.type = this.filterStatus;
  149. this.$refs.uForm.validate().then(res => {
  150. feed(that.model1.userInfo).then(data => {
  151. this.model1.userInfo.liuyan = '';
  152. this.model1.userInfo.tel = '';
  153. this.model1.userInfo.mail = '';
  154. this.model1.userInfo.name = '';
  155. let params = {
  156. type: "success",
  157. title: "成功主题(带图标)",
  158. message: "提交成功",
  159. iconUrl: "https://uviewui.com/demo/toast/success.png",
  160. }
  161. this.$refs.uToast.show({
  162. ...params
  163. });
  164. })
  165. }).catch(errors => {
  166. })
  167. }
  168. }
  169. }
  170. </script>
  171. <style lang="scss" scoped>
  172. @import url('../../../static/scss/common_cjx.css');
  173. .row-class {
  174. height: 80rpx;
  175. }
  176. .cardTop{
  177. background-image:
  178. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/yjfk.png");
  179. }
  180. .theme-text {
  181. height: 10vh;
  182. text-align: center;
  183. line-height: 11vh;
  184. .textImage {
  185. height: 80rpx;
  186. width: 400rpx;
  187. }
  188. }
  189. ::v-deep .u-form-item__body__left {
  190. width: 160rpx !important;
  191. }
  192. ::v-deep .u-form-item__body__left__content__label {
  193. font-weight: bold;
  194. font-size: 26rpx !important;
  195. color: #FFFFFF !important;
  196. }
  197. ::v-deep .u-form-item__body__right {
  198. border: 1px solid #DE00FF !important;
  199. }
  200. ::v-deep .u-textarea {
  201. background-color: rgba(0, 0, 0, 0) !important;
  202. }
  203. ::v-deep .u-textarea__field{
  204. color:#fff !important;
  205. }
  206. ::v-deep .u-form-item__body {
  207. display: flex;
  208. flex-direction: row;
  209. padding: 0 0 !important;
  210. padding-top: 10rpx !important;
  211. }
  212. ::v-deep .u-form-item__body__right__message {
  213. margin-left: 160rpx !important;
  214. }
  215. .filter-btn-group {
  216. display: flex;
  217. justify-content: flex-start;
  218. align-items: center;
  219. gap: 24rpx;
  220. margin: 10rpx 0 10rpx 0;
  221. }
  222. .filter-btn {
  223. padding: 4rpx 20rpx;
  224. border: 2rpx solid #DE00FF;
  225. color: #DE00FF;
  226. font-size: 28rpx;
  227. transition: all 0.2s;
  228. margin-left: 10rpx;
  229. }
  230. .filter-btn.active {
  231. background: #DE00FF;
  232. color: #fff;
  233. border: 2rpx solid #DE00FF;
  234. }
  235. .row-text {
  236. font-weight: bold;
  237. font-size: 26rpx;
  238. color: #FFFFFF;
  239. }
  240. .content {
  241. height: 69vh;
  242. overflow: auto;
  243. margin: 0 32rpx;
  244. padding: 32rpx 24rpx 24rpx 24rpx;
  245. background-image:
  246. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/cjx/cardBgi.png");
  247. background-size: cover;
  248. background-position: center;
  249. background-repeat: no-repeat;
  250. }
  251. .savaBtn {
  252. margin-top: 10px;
  253. font-weight: 600;
  254. }
  255. .intro-content {
  256. font-weight: 500;
  257. font-size: 28rpx;
  258. color: #F5F5F5;
  259. }
  260. </style>