evaluate.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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. order_comment({
  132. pics: arr,
  133. comment: obj.text,
  134. product_score: obj.rateValue1,
  135. service_score: obj.rateValue2,
  136. unique: obj.unique,
  137. })
  138. .then(e => {
  139. uni.navigateTo({
  140. url: '/pages/order/order?state=4'
  141. });
  142. })
  143. .catch(e => {
  144. uni.navigateTo({
  145. url: '/pages/order/order?state=4'
  146. });
  147. });
  148. },
  149. //点击图片显示大图
  150. imgInfo(i) {
  151. let tempList = [];
  152. console.log(111);
  153. this.imgList.forEach(e => {
  154. tempList.push(e.url);
  155. });
  156. console.log(tempList);
  157. //显示图片
  158. uni.previewImage({
  159. current: i,
  160. loop: false,
  161. urls: tempList,
  162. indicator: 'default'
  163. });
  164. },
  165. //删除图片
  166. delImg(i) {
  167. uni.showModal({
  168. content: '确定删除这张吗',
  169. success: res => {
  170. if (res.confirm) {
  171. this.imgList.splice(i, 1);
  172. this.imgCount++;
  173. } else if (res.cancel) {
  174. }
  175. }
  176. });
  177. },
  178. // 页面跳转
  179. navto(e) {
  180. uni.navigateTo({
  181. url: e
  182. });
  183. }
  184. }
  185. };
  186. </script>
  187. <style lang="scss">
  188. page {
  189. background: #ffffff;
  190. height: 100%;
  191. .content {
  192. background: #ffffff;
  193. height: 100%;
  194. }
  195. }
  196. /* 多条商品 */
  197. .order-item {
  198. display: flex;
  199. flex-direction: column;
  200. padding: 0rpx 30rpx;
  201. background: #fff;
  202. margin-top: 20rpx;
  203. /* 单条商品 */
  204. .goods-box-single {
  205. display: flex;
  206. padding: 20rpx 0;
  207. .goods-img {
  208. display: block;
  209. width: 120rpx;
  210. height: 120rpx;
  211. }
  212. .right {
  213. flex: 1;
  214. display: flex;
  215. flex-direction: column;
  216. padding: 0 30rpx 0 24rpx;
  217. overflow: hidden;
  218. height: 100%;
  219. .title {
  220. align-self: flex-start;
  221. font-size: $font-base + 2rpx;
  222. color: $font-color-dark;
  223. height: 80rpx;
  224. overflow:hidden;
  225. text-overflow:ellipsis;
  226. display:-webkit-box;
  227. -webkit-box-orient:vertical;
  228. -webkit-line-clamp:2;
  229. }
  230. .title-right {
  231. flex-shrink: 0;
  232. text-align: right;
  233. align-self: flex-start;
  234. }
  235. .attr-box {
  236. font-size: $font-sm + 2rpx;
  237. color: $font-color-light;
  238. }
  239. .price {
  240. font-size: $font-base + 2rpx;
  241. color: $font-color-dark;
  242. &:before {
  243. content: '¥';
  244. font-size: $font-sm;
  245. margin: 0 2rpx 0 8rpx;
  246. }
  247. }
  248. }
  249. }
  250. }
  251. .equity_box {
  252. background-color: #fafafa;
  253. border-radius: 10rpx;
  254. padding: 25rpx 25rpx;
  255. margin: 25rpx 0rpx;
  256. .text-box {
  257. height: 200rpx;
  258. textarea {
  259. font-size: 25rpx;
  260. width: 100%;
  261. height: 100%;
  262. overflow: hidden;
  263. text-overflow: ellipsis;
  264. display: -webkit-box;
  265. -webkit-box-orient: vertical;
  266. -webkit-line-clamp: 5;
  267. }
  268. }
  269. }
  270. .zhil {
  271. font-size: 28rpx !important;
  272. padding: 15rpx 15rpx;
  273. }
  274. .submit-box {
  275. bottom: 0;
  276. left: 0;
  277. width: 750rpx;
  278. }
  279. .submit-btn {
  280. margin-top: 10px;
  281. display: inline-block;
  282. width: 670rpx;
  283. height: 96rpx;
  284. line-height: 96rpx;
  285. text-align: center;
  286. background-color: #f65067 !important;
  287. opacity: 1;
  288. border-radius: 32rpx;
  289. border-width: 8rpx;
  290. border-color: rgba(255, 255, 255, 1);
  291. box-shadow: 0rpx 8rpx 12rpx rgba(0, 0, 0, 0.16);
  292. border-radius: 56rpx;
  293. font-size: 39rpx;
  294. font-weight: bold;
  295. color: rgba(255, 255, 255, 1);
  296. }
  297. .submit-btn-txt {
  298. font-size: 39rpx;
  299. font-weight: bold;
  300. line-height: 47rpx;
  301. color: rgba(255, 255, 255, 1);
  302. opacity: 1;
  303. }
  304. .map-box {
  305. width: 484rpx;
  306. height: 256rpx;
  307. border-width: 4rpx;
  308. border-color: rgba(255, 255, 255, 1);
  309. box-shadow: 0rpx 0rpx 24rpx rgba(0, 0, 0, 0.16);
  310. /* border-radius: 12rpx; */
  311. position: relative;
  312. }
  313. .map {
  314. position: absolute;
  315. top: 0;
  316. left: 0;
  317. right: 0;
  318. bottom: 0;
  319. width: 476rpx;
  320. height: 250rpx;
  321. }
  322. .map-img {
  323. position: absolute;
  324. top: 90rpx;
  325. left: 156rpx;
  326. width: 230rpx;
  327. height: 68rpx;
  328. background-color: rgba(51, 51, 51, 0.64);
  329. border-width: 1rpx;
  330. border-color: rgba(0, 0, 0, 0);
  331. border-radius: 34px;
  332. font-size: 28rpx;
  333. font-weight: bold;
  334. line-height: 66rpx;
  335. color: rgba(255, 255, 255, 1);
  336. text-align: center;
  337. }
  338. .address-box {
  339. padding: 15rpx 40rpx;
  340. margin-bottom: 10px;
  341. }
  342. .label {
  343. font-size: 36rpx;
  344. font-weight: bold;
  345. line-height: 50rpx;
  346. color: #222222;
  347. }
  348. .label-img {
  349. padding-left: 40rpx;
  350. }
  351. .add-img-box {
  352. width: 100%;
  353. flex-direction: row;
  354. flex-wrap: wrap;
  355. margin-top: 50rpx;
  356. }
  357. .add-img-item {
  358. width: 180rpx;
  359. height: 180rpx;
  360. border-radius: 24rpx;
  361. position: relative;
  362. margin: 0rpx 20rpx;
  363. margin-bottom: 25rpx;
  364. .add-img {
  365. width: 100%;
  366. height: 100%;
  367. border-radius: 24rpx;
  368. }
  369. }
  370. .add-img-camera {
  371. flex: 1;
  372. }
  373. .add-img-del {
  374. position: absolute;
  375. width: 40rpx;
  376. height: 40rpx;
  377. left: 155rpx;
  378. bottom: 155rpx;
  379. //background-color: rgba(238, 0, 0, 1);
  380. border-radius: 20rpx;
  381. }
  382. .address-time {
  383. width: 484rpx;
  384. height: 88rpx;
  385. background-color: rgba(245, 245, 245, 1);
  386. opacity: 1;
  387. border-radius: 24rpx;
  388. text-align: center;
  389. font-size: 35rpx;
  390. font-weight: 500;
  391. color: rgba(51, 51, 51, 1);
  392. }
  393. .line {
  394. width: 750rpx;
  395. height: 1px;
  396. transform: scaleY(0.3);
  397. background-color: rgba(0, 0, 0, 0.5);
  398. }
  399. </style>