evaluate.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. <template>
  2. <view class="content">
  3. <view class="order-item">
  4. <view class="goods-box-single">
  5. <image class="goods-img" :src="productInfo.image" mode="aspectFill"></image>
  6. <view class="right position-relative">
  7. <view class="flex">
  8. <text class="title">{{ productInfo.store_name }}</text>
  9. <view class="title-right">
  10. <view class="price">{{ productInfo.price }}</view>
  11. <view class="attr-box">x{{ list.cart_num }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. <view>
  17. <view class="flex_item zhil">
  18. <view>商品质量</view>
  19. <view><uniRate text="1" size="20" margin="10" :value="rateValue1" @change="rateChange1"></uniRate></view>
  20. </view>
  21. <view class="flex_item zhil">
  22. <view>服务态度</view>
  23. <view><uniRate text="1" size="20" margin="10" :value="rateValue2" @change="rateChange2"></uniRate></view>
  24. </view>
  25. <view class="equity_box">
  26. <view class="text-box uni-textarea">
  27. <textarea placeholder-style="color:#999" :placeholder="placeholder" @blur="bindTextAreaBlur"></textarea>
  28. </view>
  29. <view class="">
  30. <view class="add-img-box">
  31. <view class="add-img-item" v-for="(item, index) in imgList" :key="index">
  32. <image class="add-img" @click.stop="imgInfo(index)" :src="item.url" mode="aspectFill"></image>
  33. <image class="add-img-del" @click.stop="delImg(index)" src="https://tmp01.kktv6.com/img/delete.png"></image>
  34. </view>
  35. <view v-if="imgList.length < 9" class="add-img-item" @click.stop="scImg()">
  36. <!-- <image class="add-img" src="https://37shop.liuniu946.com/front/img/add.png"></image> -->
  37. <view class="video-box">
  38. <view class="auto-box">
  39. <image src="https://tmp01.kktv6.com/img/sctp.png" class="video-img"></image>
  40. </view>
  41. <!-- 上传图片 -->
  42. <view class="up-txt">上传图片</view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. <view @click.stop="submit" class="address-box submit-box"><text class="submit-btn">立即评价</text></view>
  51. </view>
  52. </template>
  53. <script>
  54. import { product, upload, order_comment } from '@/api/order.js';
  55. import uniRate from '@/components/uni-rate/uni-rate.vue';
  56. export default {
  57. components: {
  58. uniRate
  59. },
  60. data() {
  61. return {
  62. list: '', //订单详情
  63. productInfo: '',
  64. text: '', //评论内容
  65. placeholder: '商品满足你的期待么?说说你的想法,分享给想买的他们吧~',
  66. imgList: [],
  67. unique: '', //商品唯一标识码
  68. cloudimgList: [],
  69. rateValue1: '', //商品质量
  70. rateValue2: '', //服务态度
  71. imgCount: 6 //最多支持9张上传,可以修改
  72. };
  73. },
  74. onLoad(option) {
  75. this.unique = option.unique;
  76. this.loadOrder();
  77. },
  78. onShow() {},
  79. methods: {
  80. //text
  81. bindTextAreaBlur: function(e) {
  82. this.text = e.detail.value;
  83. },
  84. //获取收入支出信息
  85. async loadOrder() {
  86. product({
  87. unique: this.unique
  88. }).then(e => {
  89. this.list = e.data;
  90. this.productInfo = e.data.productInfo;
  91. });
  92. },
  93. //商品质量评分
  94. rateChange1(val) {
  95. this.rateValue1 = val.value;
  96. },
  97. //服务态度评分
  98. rateChange2(val) {
  99. this.rateValue2 = val.value;
  100. },
  101. //单张上传图片
  102. scImg() {
  103. let obj = this;
  104. console.log(obj.imgCount, 11);
  105. if (obj.imgCount == 0) {
  106. uni.showToast({
  107. title: '最多添加9张图片',
  108. icon: 'none'
  109. });
  110. return;
  111. }
  112. upload({
  113. file: ''
  114. })
  115. .then(e => {
  116. obj.imgList = [...obj.imgList, ...e];
  117. this.imgCount = 9 - this.imgList.length;
  118. })
  119. .catch(e => {});
  120. },
  121. //提交评论
  122. submit(e) {
  123. let obj = this;
  124. // if (obj.imgList.length < 1) {
  125. // uni.showToast({
  126. // title: '请添加图片',
  127. // icon: 'none'
  128. // });
  129. // return;
  130. // }
  131. if (!obj.rateValue1) {
  132. obj.$api.msg('请评价商品质量')
  133. return;
  134. }
  135. if (!obj.rateValue2) {
  136. obj.$api.msg('请评价服务态度')
  137. return;
  138. }
  139. for (let i = 0; i < obj.imgList.length; i++) {
  140. obj.cloudimgList.push(obj.imgList[i].url);
  141. }
  142. let arr = obj.cloudimgList.join(',');
  143. order_comment({
  144. pics: arr,
  145. comment: obj.text,
  146. product_score: obj.rateValue1,
  147. service_score: obj.rateValue2,
  148. unique: obj.unique,
  149. })
  150. .then(e => {
  151. uni.navigateTo({
  152. url: '/pages/order/order?state=4'
  153. });
  154. })
  155. .catch(e => {
  156. uni.navigateTo({
  157. url: '/pages/order/order?state=4'
  158. });
  159. });
  160. },
  161. //点击图片显示大图
  162. imgInfo(i) {
  163. let tempList = [];
  164. console.log(111);
  165. this.imgList.forEach(e => {
  166. tempList.push(e.url);
  167. });
  168. console.log(tempList);
  169. //显示图片
  170. uni.previewImage({
  171. current: i,
  172. loop: false,
  173. urls: tempList,
  174. indicator: 'default'
  175. });
  176. },
  177. //删除图片
  178. delImg(i) {
  179. uni.showModal({
  180. content: '确定删除这张吗',
  181. success: res => {
  182. if (res.confirm) {
  183. this.imgList.splice(i, 1);
  184. this.imgCount++;
  185. } else if (res.cancel) {
  186. }
  187. }
  188. });
  189. },
  190. // 页面跳转
  191. navto(e) {
  192. uni.navigateTo({
  193. url: e
  194. });
  195. }
  196. }
  197. };
  198. </script>
  199. <style lang="scss">
  200. page {
  201. background: #ffffff;
  202. height: 100%;
  203. .content {
  204. background: #ffffff;
  205. height: 100%;
  206. }
  207. }
  208. /* 多条商品 */
  209. .order-item {
  210. display: flex;
  211. flex-direction: column;
  212. padding: 0rpx 30rpx;
  213. background: #fff;
  214. margin-top: 20rpx;
  215. /* 单条商品 */
  216. .goods-box-single {
  217. display: flex;
  218. padding: 20rpx 0;
  219. .goods-img {
  220. display: block;
  221. width: 120rpx;
  222. height: 120rpx;
  223. }
  224. .right {
  225. flex: 1;
  226. display: flex;
  227. flex-direction: column;
  228. padding: 0 30rpx 0 24rpx;
  229. overflow: hidden;
  230. height: 100%;
  231. .title {
  232. align-self: flex-start;
  233. font-size: $font-base + 2rpx;
  234. color: $font-color-dark;
  235. height: 80rpx;
  236. overflow:hidden;
  237. text-overflow:ellipsis;
  238. display:-webkit-box;
  239. -webkit-box-orient:vertical;
  240. -webkit-line-clamp:2;
  241. }
  242. .title-right {
  243. flex-shrink: 0;
  244. text-align: right;
  245. align-self: flex-start;
  246. }
  247. .attr-box {
  248. font-size: $font-sm + 2rpx;
  249. color: $font-color-light;
  250. }
  251. .price {
  252. font-size: $font-base + 2rpx;
  253. color: $font-color-dark;
  254. &:before {
  255. content: '¥';
  256. font-size: $font-sm;
  257. margin: 0 2rpx 0 8rpx;
  258. }
  259. }
  260. }
  261. }
  262. }
  263. .equity_box {
  264. background-color: #fafafa;
  265. border-radius: 10rpx;
  266. padding: 25rpx 25rpx;
  267. margin: 25rpx 0rpx;
  268. .text-box {
  269. height: 200rpx;
  270. textarea {
  271. font-size: 25rpx;
  272. width: 100%;
  273. height: 100%;
  274. overflow: hidden;
  275. text-overflow: ellipsis;
  276. display: -webkit-box;
  277. -webkit-box-orient: vertical;
  278. -webkit-line-clamp: 5;
  279. }
  280. }
  281. }
  282. .zhil {
  283. font-size: 28rpx !important;
  284. padding: 15rpx 15rpx;
  285. }
  286. .submit-box {
  287. bottom: 0;
  288. left: 0;
  289. width: 750rpx;
  290. }
  291. .submit-btn {
  292. margin-top: 10px;
  293. display: inline-block;
  294. width: 670rpx;
  295. height: 96rpx;
  296. line-height: 96rpx;
  297. text-align: center;
  298. background-color: #e93323 !important;
  299. opacity: 1;
  300. border-radius: 32rpx;
  301. border-width: 8rpx;
  302. border-color: rgba(255, 255, 255, 1);
  303. box-shadow: 0rpx 8rpx 12rpx rgba(0, 0, 0, 0.16);
  304. border-radius: 56rpx;
  305. font-size: 39rpx;
  306. font-weight: bold;
  307. color: rgba(255, 255, 255, 1);
  308. }
  309. .submit-btn-txt {
  310. font-size: 39rpx;
  311. font-weight: bold;
  312. line-height: 47rpx;
  313. color: rgba(255, 255, 255, 1);
  314. opacity: 1;
  315. }
  316. .map-box {
  317. width: 484rpx;
  318. height: 256rpx;
  319. border-width: 4rpx;
  320. border-color: rgba(255, 255, 255, 1);
  321. box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.16);
  322. /* border-radius: 12rpx; */
  323. position: relative;
  324. }
  325. .map {
  326. position: absolute;
  327. top: 0;
  328. left: 0;
  329. right: 0;
  330. bottom: 0;
  331. width: 476rpx;
  332. height: 250rpx;
  333. }
  334. .map-img {
  335. position: absolute;
  336. top: 90rpx;
  337. left: 156rpx;
  338. width: 230rpx;
  339. height: 68rpx;
  340. background-color: rgba(51, 51, 51, 0.64);
  341. border-width: 1rpx;
  342. border-color: rgba(0, 0, 0, 0);
  343. border-radius: 34px;
  344. font-size: 28rpx;
  345. font-weight: bold;
  346. line-height: 66rpx;
  347. color: rgba(255, 255, 255, 1);
  348. text-align: center;
  349. }
  350. .address-box {
  351. padding: 15rpx 40rpx;
  352. margin-bottom: 10px;
  353. }
  354. .label {
  355. font-size: 36rpx;
  356. font-weight: bold;
  357. line-height: 50rpx;
  358. color: #222222;
  359. }
  360. .label-img {
  361. padding-left: 40rpx;
  362. }
  363. .add-box {
  364. padding: 15rpx 0;
  365. flex-wrap: wrap;
  366. }
  367. .add-img-box {
  368. width: 100%;
  369. flex-wrap: wrap;
  370. display: flex;
  371. }
  372. .add-img-item {
  373. width: 180rpx;
  374. height: 180rpx;
  375. border-radius: 10rpx;
  376. position: relative;
  377. margin-bottom: 25rpx;
  378. margin-right: 40rpx;
  379. &:nth-child(3n) {
  380. margin-right: 0;
  381. }
  382. .video-box {
  383. width: 180rpx;
  384. height: 180rpx;
  385. border: 1px dashed #ABABAB;
  386. border-radius: 10rpx;
  387. // background-color: #FFFFFF;
  388. .auto-box {
  389. width: 42rpx;
  390. height: 40rpx;
  391. margin: 40rpx auto 0;
  392. .video-img {
  393. width: 42rpx;
  394. height: 40rpx;
  395. }
  396. }
  397. .up-txt {
  398. font-size: 34rpx;
  399. font-weight: 500;
  400. color: #ABABAB;
  401. margin: 20rpx 0 0;
  402. text-align: center;
  403. }
  404. }
  405. .add-img {
  406. width: 100%;
  407. height: 100%;
  408. border-radius: 10rpx;
  409. }
  410. }
  411. .add-img-camera {
  412. flex: 1;
  413. }
  414. .add-img-del {
  415. position: absolute;
  416. width: 40rpx;
  417. height: 40rpx;
  418. right: 0;
  419. top: 0;
  420. //background-color: rgba(238, 0, 0, 1);
  421. // border-radius: 20rpx;
  422. }
  423. .address-time {
  424. width: 484rpx;
  425. height: 88rpx;
  426. background-color: rgba(245, 245, 245, 1);
  427. opacity: 1;
  428. border-radius: 24rpx;
  429. text-align: center;
  430. font-size: 35rpx;
  431. font-weight: 500;
  432. color: rgba(51, 51, 51, 1);
  433. }
  434. .line {
  435. width: 750rpx;
  436. height: 1px;
  437. transform: scaleY(0.3);
  438. background-color: rgba(0, 0, 0, 0.5);
  439. }
  440. </style>