evaluate.vue 9.1 KB

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