evaluate.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <config>
  2. {
  3. "navigationBarTitleText": "评价",
  4. }
  5. </config>
  6. <template>
  7. <div class="container">
  8. <div class="top">
  9. <div class="address">
  10. <div class="text">
  11. <van-image
  12. width="18"
  13. height="18"
  14. style="margin-left:12px"
  15. lazy-load
  16. src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-06-14-32-43SJNYKNqV.png"
  17. />
  18. <div class="text1">益禾堂(一食堂)</div>
  19. </div>
  20. <div class="text">
  21. <van-image
  22. width="24"
  23. height="24"
  24. lazy-load
  25. @click="choice"
  26. :src="
  27. `https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${
  28. flag ? '2021-09-02-15-24-13nwVzJqXX.png' : '2021-09-02-14-49-00OrkCuHPB.png'
  29. }`
  30. "
  31. />
  32. <div class="text1">匿名评价</div>
  33. </div>
  34. </div>
  35. <div class="content">
  36. <div class="text1">总体</div>
  37. <van-rate
  38. :value="value"
  39. :size="16"
  40. color="#159EFF"
  41. void-icon="star"
  42. void-color="#eee"
  43. @change="onChange"
  44. />
  45. <div class="text1 text2">非常满意</div>
  46. </div>
  47. <div class="content">
  48. <div class="text1">口味</div>
  49. <van-rate
  50. :value="value"
  51. :size="16"
  52. color="#159EFF"
  53. void-icon="star"
  54. void-color="#eee"
  55. @change="onChange2"
  56. />
  57. <div class="text1 text2">一般</div>
  58. </div>
  59. <div class="content">
  60. <div class="text1">配送</div>
  61. <van-rate
  62. :value="value"
  63. :size="16"
  64. color="#159EFF"
  65. void-icon="star"
  66. void-color="#eee"
  67. @change="onChange3"
  68. />
  69. <div class="text1 text2">差</div>
  70. </div>
  71. </div>
  72. <div class="evaluate">
  73. <div class="title">评价</div>
  74. <van-field
  75. :value="form.description"
  76. @input="form.description = $event.detail"
  77. :border="false"
  78. rows="1"
  79. autosize
  80. type="textarea"
  81. placeholder="请填写您的用餐评价,推荐给大家"
  82. />
  83. <van-uploader
  84. class="uploader"
  85. :max-count="3"
  86. :file-list="images"
  87. :after-read="afterRead"
  88. @delete="deleteImg"
  89. />
  90. <div class="text1">最多上传三张</div>
  91. </div>
  92. <div class="bottom">
  93. <div class="text" v-for="(item, index) in lists" :key="index">
  94. <div class="text1">{{ item.name }}</div>
  95. <div class="text2">
  96. <div class="text3">
  97. <van-image
  98. width="16"
  99. height="16"
  100. lazy-load
  101. @click="stepFlag"
  102. :src="
  103. `https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${
  104. stepflag ? '2021-09-06-11-21-07FIiyRFOr.png' : '2021-09-06-11-18-56FYFucJaK.png'
  105. }`
  106. "
  107. />
  108. <div class="text4">踩</div>
  109. </div>
  110. <div class="text3">
  111. <van-image
  112. width="16"
  113. height="16"
  114. lazy-load
  115. @click="fabulousFlag"
  116. :src="
  117. `https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${
  118. fabulous ? '2021-09-06-11-19-33eTFCBfIW.png' : '2021-09-06-11-21-26mmGMCJVF.png'
  119. }`
  120. "
  121. />
  122. <div class="text4">赞</div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="btn">
  128. <van-button type="primary" block>确认</van-button>
  129. </div>
  130. </div>
  131. </template>
  132. <script>
  133. export default {
  134. data() {
  135. return {
  136. form: {},
  137. list: [],
  138. flag: false,
  139. stepflag: false,
  140. fabulous: false,
  141. img: [],
  142. lists: [{ name: '寿司' }],
  143. images: []
  144. };
  145. },
  146. methods: {
  147. onChange() {},
  148. onChange2() {},
  149. onChange3() {},
  150. afterRead(file) {
  151. this.showLoading();
  152. this.$http
  153. .uploadFile(file.path)
  154. .then(res => {
  155. this.hideLoading();
  156. console.log(res);
  157. this.images = [
  158. {
  159. url: res
  160. }
  161. ];
  162. // return this.img.push(res).map(item => {
  163. // return (this.images = [{ url: item }]);
  164. // });
  165. // console.log(this.images);
  166. // console.log(this.images);
  167. })
  168. .catch(e => {
  169. this.hideLoading();
  170. wx.showToast({
  171. icon: 'none',
  172. title: e.error
  173. });
  174. });
  175. },
  176. deleteImg(e) {
  177. let list = [...this.images];
  178. list.splice(e.detail.index, 1);
  179. this.images = list;
  180. },
  181. choice() {
  182. if (this.flag === true) {
  183. this.flag = false;
  184. } else {
  185. this.flag = true;
  186. }
  187. },
  188. stepFlag() {
  189. if (this.stepflag === true) {
  190. this.stepflag = false;
  191. this.fabulous = false;
  192. } else {
  193. this.stepflag = true;
  194. this.fabulous = false;
  195. }
  196. },
  197. fabulousFlag() {
  198. if (this.fabulous === true) {
  199. this.stepflag = false;
  200. this.fabulous = false;
  201. } else {
  202. this.fabulous = true;
  203. this.stepflag = false;
  204. }
  205. }
  206. }
  207. };
  208. </script>
  209. <style lang="less" scoped>
  210. .container {
  211. padding: 16px 12px 100px 12px;
  212. background: #f5f7fa;
  213. /deep/ .van-rate__item {
  214. padding-left: 20px !important;
  215. color: #000;
  216. }
  217. /deep/ .van-cell {
  218. padding: var(--cell-vertical-padding, 10px) var(--cell-horizontal-padding, 12px);
  219. }
  220. /deep/ .van-cell__value {
  221. height: 100px !important;
  222. }
  223. .top {
  224. width: 351px;
  225. height: 188px;
  226. background: #ffffff;
  227. border-radius: 12px;
  228. .address {
  229. .flex();
  230. justify-content: space-between;
  231. padding: 20px 0;
  232. .text {
  233. .flex();
  234. margin-right: 12px;
  235. line-height: 10px;
  236. .text1 {
  237. font-size: 13px;
  238. font-weight: 400;
  239. color: #000000;
  240. line-height: 18px;
  241. margin-left: 4px;
  242. }
  243. }
  244. }
  245. .content {
  246. .flex();
  247. margin: 0 12px 18px 12px;
  248. .text1 {
  249. .span();
  250. &.text2 {
  251. margin-left: 20px;
  252. }
  253. }
  254. }
  255. }
  256. .evaluate {
  257. width: 351px;
  258. height: 266px;
  259. background: #ffffff;
  260. border-radius: 12px;
  261. padding: 20px 0 20px 0;
  262. margin: 16px 0;
  263. .title {
  264. .span();
  265. margin: 0 0 6px 12px;
  266. }
  267. .uploader {
  268. margin: 112px 0 0 12px;
  269. }
  270. .text1 {
  271. font-size: 13px;
  272. font-weight: 400;
  273. color: #aaabad;
  274. line-height: 18px;
  275. margin: 8px 0 0 12px;
  276. }
  277. }
  278. .bottom {
  279. width: 351px;
  280. padding: 20px 0;
  281. background: #ffffff;
  282. border-radius: 12px;
  283. .text {
  284. .flex();
  285. justify-content: space-between;
  286. margin: 0 12px;
  287. .text1 {
  288. .span();
  289. }
  290. .text2 {
  291. .flex();
  292. line-height: 6px;
  293. .text3 {
  294. .flex();
  295. margin-left: 16px;
  296. .text4 {
  297. .span();
  298. font-weight: 400;
  299. margin-left: 4px;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. .btn {
  306. position: fixed;
  307. bottom: 0;
  308. left: 0;
  309. right: 0;
  310. padding: 6px 43px;
  311. background-color: #fff;
  312. .bottom(6px);
  313. }
  314. }
  315. </style>