evaluate.vue 8.0 KB

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