evaluate.vue 8.8 KB

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