evaluate.vue 8.3 KB

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