evaluate.vue 8.5 KB

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