feedback.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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" src="/static/images/common/logo.png" mode="aspectFit" />
  11. </u-col>
  12. <u-col span="4">
  13. <!-- <image class="commodity-img" src="/static/images/common/commodity.png" mode="aspectFit" /> -->
  14. </u-col>
  15. <u-col span="4">
  16. </u-col>
  17. </u-row>
  18. </view>
  19. <view class="theme-text">
  20. <image src="https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/text.png"
  21. class="textImage"></image>
  22. </view>
  23. <view class="intro-card">
  24. <view class="intro-view">
  25. <view class="intro-label">
  26. <view class="label-title">
  27. 意见反馈
  28. </view>
  29. </view>
  30. <view class="content">
  31. <view class="intro-content">
  32. 欢迎光临!各位梅山古镇的顾客朋友们,为了提供更优质的产品和更好的服务给你们,向各位征集对本公司的评价、期望、意见和建议,非常期待你们的反馈。我们将会报以更优质的服务。谢谢您的协助和厚爱。评价,建议一经公司评选和采纳,会有丰厚奖品赠送哦,赶快来参加吧!
  33. </view>
  34. <view class="from">
  35. <view class="filter-btn-group">
  36. <view class="row-text">留言类型:</view>
  37. <view v-for="(item, idx) in filterOptions" :key="idx"
  38. :class="['filter-btn', filterStatus === item.value ? 'active' : '']"
  39. @click="onFilterChange(item.value)">
  40. {{ item.label }}
  41. </view>
  42. </view>
  43. <u--form labelPosition="left" :model="model1" :rules="rules" ref="uForm">
  44. <u-form-item label="留言人姓名:" prop="userInfo.name" ref="item1">
  45. <u--input v-model="model1.userInfo.name" border="none"></u--input>
  46. </u-form-item>
  47. <u-form-item label="联系电话:" prop="userInfo.tel" ref="item1">
  48. <u--input v-model="model1.userInfo.tel" border="none"></u--input>
  49. </u-form-item>
  50. <u-form-item label="E-mail:" prop="userInfo.mail" ref="item1">
  51. <u--input v-model="model1.userInfo.mail" border="none"></u--input>
  52. </u-form-item>
  53. <u-form-item label="留言:" ref="item1">
  54. <u--textarea v-model="model1.userInfo.liuyan" border="none"></u--textarea>
  55. </u-form-item>
  56. </u--form>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <u-toast ref="uToast"></u-toast>
  62. <!-- 返回按钮 -->
  63. <view class="footer-btn">
  64. <view @click="saveData" class="return-button" style="margin-right: 180rpx;">保存</view>
  65. <view @click="goBack" class="return-button">返回</view>
  66. </view>
  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. {
  106. required: true,
  107. message: '请输入手机号',
  108. trigger: ['change','blur'],
  109. },
  110. {
  111. // 自定义验证函数,见上说明
  112. validator: (rule, value, callback) => {
  113. console.log(value);
  114. // 上面有说,返回true表示校验通过,返回false表示不通过
  115. // uni.$u.test.mobile()就是返回true或者false的
  116. return uni.$u.test.mobile(value);
  117. },
  118. message: '手机号码不正确',
  119. // 触发器可以同时用blur和change
  120. trigger: ['change','blur'],
  121. }
  122. ],
  123. },
  124. }
  125. },
  126. onReady() { // 如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则
  127. this.$refs.uForm.setRules(this.rules)
  128. },
  129. onLoad() {
  130. this.scanCode = uni.getStorageSync('scanCode');
  131. this.model1.userInfo.qrCode = this.scanCode;
  132. },
  133. methods: {
  134. goBack() {
  135. uni.navigateBack();
  136. },
  137. onFilterChange(val) {
  138. if (this.filterStatus !== val) {
  139. this.filterStatus = val;
  140. }
  141. },
  142. saveData() {
  143. let that = this;
  144. this.model1.userInfo.type = this.filterStatus;
  145. this.$refs.uForm.validate().then(res => {
  146. feed(that.model1.userInfo).then(data => {
  147. this.model1.userInfo.liuyan = '';
  148. this.model1.userInfo.tel = '';
  149. this.model1.userInfo.mail = '';
  150. this.model1.userInfo.name = '';
  151. let params = {
  152. type: "success",
  153. title: "成功主题(带图标)",
  154. message: "提交成功",
  155. iconUrl: "https://uviewui.com/demo/toast/success.png",
  156. }
  157. this.$refs.uToast.show({
  158. ...params
  159. });
  160. })
  161. }).catch(errors => {
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss" scoped>
  168. @import url('../../../static/scss/common.css');
  169. .row-class {
  170. height: 80rpx;
  171. }
  172. .logo-img {
  173. background-size: cover;
  174. /* 确保背景图片自适应填充整个容器 */
  175. background-position: center;
  176. /* 背景图片居中显示 */
  177. background-repeat: no-repeat;
  178. /* 防止背景图重复 */
  179. height: 42rpx;
  180. width: 62%;
  181. }
  182. .commodity-img {
  183. background-size: cover;
  184. /* 确保背景图片自适应填充整个容器 */
  185. background-position: center;
  186. /* 背景图片居中显示 */
  187. background-repeat: no-repeat;
  188. /* 防止背景图重复 */
  189. height: 35rpx;
  190. width: 100%;
  191. }
  192. .theme-text {
  193. height: 10vh;
  194. text-align: center;
  195. line-height: 11vh;
  196. .textImage {
  197. height: 80rpx;
  198. width: 400rpx;
  199. }
  200. }
  201. .intro-card {
  202. margin: 0 32rpx;
  203. padding: 32rpx 24rpx 24rpx 24rpx;
  204. background: rgba(131, 100, 71, 0.5);
  205. border-radius: 10rpx;
  206. .intro-view {
  207. border: 1px solid #341B10;
  208. padding: 10px;
  209. margin-top: 20rpx;
  210. position: relative;
  211. .intro-label {
  212. background-image:
  213. url("https://hyscancode.oss-cn-hangzhou.aliyuncs.com/xiaochengxu/guzhenganzi/label.png");
  214. /* 使用绝对路径 */
  215. background-size: contain;
  216. background-repeat: no-repeat;
  217. width: 220rpx;
  218. height: 120rpx;
  219. position: absolute;
  220. margin-top: -70rpx;
  221. align-content: center;
  222. .label-title {
  223. font-weight: bold;
  224. font-size: 30rpx;
  225. color: #341B10;
  226. text-align: center;
  227. margin-left: 10px;
  228. height: 120rpx;
  229. line-height: 110rpx;
  230. }
  231. }
  232. .intro-content {
  233. font-size: 26rpx;
  234. color: #5c4322;
  235. line-height: 1.8;
  236. text-align: justify;
  237. margin-top: 20rpx;
  238. }
  239. }
  240. }
  241. ::v-deep .u-form-item__body__left {
  242. width: 160rpx !important;
  243. }
  244. ::v-deep .u-form-item__body__left__content__label {
  245. font-weight: bold;
  246. font-size: 26rpx !important;
  247. color: #FFFFFF !important;
  248. }
  249. ::v-deep .u-form-item__body__right {
  250. border: 1px solid #9B0000 !important;
  251. }
  252. ::v-deep .u-textarea {
  253. background-color: rgba(0, 0, 0, 0) !important;
  254. }
  255. ::v-deep .u-form-item__body {
  256. display: flex;
  257. flex-direction: row;
  258. padding: 0 0 !important;
  259. padding-top: 10rpx !important;
  260. }
  261. ::v-deep .u-form-item__body__right__message {
  262. margin-left: 160rpx !important;
  263. }
  264. .filter-btn-group {
  265. display: flex;
  266. justify-content: flex-start;
  267. align-items: center;
  268. gap: 24rpx;
  269. margin: 10rpx 0 10rpx 0;
  270. }
  271. .filter-btn {
  272. padding: 4rpx 20rpx;
  273. border: 2rpx solid #b22222;
  274. color: #b22222;
  275. font-size: 28rpx;
  276. transition: all 0.2s;
  277. margin-left: 10rpx;
  278. }
  279. .filter-btn.active {
  280. background: #b22222;
  281. color: #fff;
  282. border: 2rpx solid #b22222;
  283. }
  284. .row-text {
  285. font-weight: bold;
  286. font-size: 26rpx;
  287. color: #FFFFFF;
  288. }
  289. .content {
  290. max-height: 60vh;
  291. overflow: auto;
  292. }
  293. .savaBtn {
  294. margin-top: 10px;
  295. font-weight: 600;
  296. }
  297. </style>