orderRefund.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="content">
  3. <view class="order-item">
  4. <scroll-view v-if="listStyle == 1" class="goods-box" scroll-x>
  5. <view v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex" class="goods-item">
  6. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  7. </view>
  8. </scroll-view>
  9. <view v-if="listStyle == 2" class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.cartInfo" :key="goodsIndex">
  10. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  11. <view class="right">
  12. <text class="title clamp">{{ goodsItem.productInfo.store_name }}</text>
  13. <text class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x {{ goodsItem.cart_num }}</text>
  14. <text class="price">{{ goodsItem.productInfo.price }}</text>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="orderDetial">
  19. <view class="row b-b flex">
  20. <text class="tit">订单总价</text>
  21. <view class="input">¥{{ item.total_price }}</view>
  22. </view>
  23. <view class="row b-b flex">
  24. <text class="tit">邮费</text>
  25. <view class="input">{{ item.pay_postage > 0 ? '¥' +item.pay_postage : '免邮费' }}</view>
  26. </view>
  27. <view class="row b-b flex" v-if="item.coupon_id > 0">
  28. <text class="tit">优惠券</text>
  29. <view class="input">-¥{{ item.coupon_price }}</view>
  30. </view>
  31. <view class="row b-b flex" v-if="item.use_integral > 0">
  32. <text class="tit">积分抵扣</text>
  33. <view class="input">-¥{{ item.use_integral }}</view>
  34. </view>
  35. <view class="row b-b flex">
  36. <text class="tit ">实付</text>
  37. <view class="input payColor">¥{{ item.pay_price }}</view>
  38. </view>
  39. </view>
  40. <view class="row b-b">
  41. <text class="tit">退款理由</text>
  42. <picker mode="selector" :range="value" @change="bindChange">
  43. <view class="refund" v-if="refund">{{ refund || '请选择退款理由' }}</view>
  44. <view class="noRefund" v-else>请选择退款理由</view>
  45. </picker>
  46. </view>
  47. <view class="add_box">
  48. <view class="add_name">上传图片</view>
  49. <view class="add-img-box flex_item">
  50. <view class="add-img-item" v-for="(item, index) in imgList" :key="index">
  51. <image class="add-img" @click.stop="imgInfo(index)" :src="item.url" mode="aspectFill"></image>
  52. <image class="add-img-del" @click.stop="delImg(index)" src="/static/img/delete.png"></image>
  53. </view>
  54. <view v-if="imgList.length < 9" class="add-img-item" @click.stop="scImg()">
  55. <image class="add-img" src="/static/img/add.png"></image>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="row b-b">
  60. <text class="tit">备注说明</text>
  61. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  62. </view>
  63. <button class="add-btn" @click="confirm">提交</button>
  64. </view>
  65. </template>
  66. <script>
  67. import { refund, refundReason, orderDetail,upload } from '@/api/order.js';
  68. export default {
  69. data() {
  70. return {
  71. refund: '', //退款理由
  72. reason: '', //备注
  73. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  74. orderId: '',
  75. item: {},
  76. listStyle: 2,
  77. imgList: [],
  78. imgCount: 6 ,//最多支持9张上传,可以修改
  79. cloudimgList: [],
  80. };
  81. },
  82. onLoad(option) {
  83. this.orderId = option.id;
  84. this.refundReason();
  85. this.loadOrder();
  86. },
  87. methods: {
  88. // 切换选中事件
  89. bindChange(e) {
  90. this.refund = this.value[e.detail.value];
  91. },
  92. // 加载退款理由
  93. refundReason() {
  94. refundReason({}).then(e => {
  95. this.value = e.data;
  96. });
  97. },
  98. loadOrder() {
  99. orderDetail({}, this.orderId).then(e => {
  100. this.item = e.data;
  101. });
  102. },
  103. //单张上传图片
  104. scImg() {
  105. let obj = this;
  106. if (obj.imgCount == 0) {
  107. uni.showToast({
  108. title: '最多添加6张图片',
  109. icon: 'none'
  110. });
  111. return;
  112. }
  113. upload({
  114. file: ''
  115. })
  116. .then(e => {
  117. console.log(e,'e')
  118. obj.imgList = [...obj.imgList, ...e];
  119. obj.imgCount = 6 - obj.imgList.length;
  120. })
  121. .catch(e => {});
  122. },
  123. //提交
  124. confirm() {
  125. let obj = this;
  126. if (!obj.refund) {
  127. obj.$api.msg('请选择退货理由');
  128. return false;
  129. }
  130. for (let i = 0; i < obj.imgList.length; i++) {
  131. obj.cloudimgList.push(obj.imgList[i].url);
  132. }
  133. let arr = obj.cloudimgList.join(',');
  134. refund({
  135. text: obj.refund,
  136. uni: obj.orderId,
  137. refund_reason_wap_explain: obj.reason,
  138. refund_reason_wap_img:arr
  139. }).then(function(e) {
  140. console.log(e,'e')
  141. obj.$api.msg('提交成功');
  142. setTimeout(function() {
  143. uni.navigateTo({
  144. url:'/pages/order/order?state=-3'
  145. })
  146. }, 1000);
  147. // uni.showToast({
  148. // title:'提交成功',
  149. // duration:1500,
  150. // icon:'none'
  151. // })
  152. });
  153. },
  154. //点击图片显示大图
  155. imgInfo(i) {
  156. let tempList = [];
  157. this.imgList.forEach(e => {
  158. tempList.push(e.url);
  159. });
  160. console.log(tempList);
  161. //显示图片
  162. uni.previewImage({
  163. current: i,
  164. loop: false,
  165. urls: tempList,
  166. indicator: 'default'
  167. });
  168. },
  169. //删除图片
  170. delImg(i) {
  171. uni.showModal({
  172. content: '确定删除这张吗',
  173. success: res => {
  174. if (res.confirm) {
  175. this.imgList.splice(i, 1);
  176. this.imgCount++;
  177. } else if (res.cancel) {
  178. }
  179. }
  180. });
  181. },
  182. }
  183. };
  184. </script>
  185. <style lang="scss">
  186. page {
  187. background: $page-color-base;
  188. padding-top: 16rpx;
  189. }
  190. .orderDetial {
  191. .row {
  192. .input {
  193. text-align: right;
  194. }
  195. }
  196. }
  197. //图片
  198. .add_box{
  199. background-color: #ffffff;
  200. padding: 25rpx 0rpx;
  201. border-bottom: 1px solid #e4e7ed;
  202. .add_name{
  203. font-size: 30rpx;
  204. padding-left: 25rpx;
  205. }
  206. }
  207. .add-img-box {
  208. width: 100%;
  209. flex-direction: row;
  210. flex-wrap: wrap;
  211. margin-top: 50rpx;
  212. }
  213. .add-img-item {
  214. width: 150rpx;
  215. height: 150rpx;
  216. border-radius: 24rpx;
  217. position: relative;
  218. margin-bottom: 80rpx;
  219. margin-left: 55rpx;
  220. .add-img {
  221. width: 100%;
  222. height: 100%;
  223. border-radius: 24rpx;
  224. }
  225. }
  226. .add-img-camera {
  227. flex: 1;
  228. }
  229. .add-img-del {
  230. position: absolute;
  231. width: 40rpx;
  232. height: 40rpx;
  233. left: 135rpx;
  234. bottom: 135rpx;
  235. //background-color: rgba(238, 0, 0, 1);
  236. border-radius: 20rpx;
  237. }
  238. .address-time {
  239. width: 484rpx;
  240. height: 88rpx;
  241. background-color: rgba(245, 245, 245, 1);
  242. opacity: 1;
  243. border-radius: 24rpx;
  244. text-align: center;
  245. font-size: 35rpx;
  246. font-weight: 500;
  247. color: rgba(51, 51, 51, 1);
  248. }
  249. .line {
  250. width: 750rpx;
  251. height: 1px;
  252. transform: scaleY(0.3);
  253. background-color: rgba(0, 0, 0, 0.5);
  254. }
  255. .row {
  256. display: flex;
  257. align-items: center;
  258. position: relative;
  259. padding: 0 30rpx;
  260. height: 110rpx;
  261. background: #fff;
  262. .refund {
  263. font-size: 30rpx;
  264. color: $font-color-dark;
  265. }
  266. .noRefund {
  267. font-size: 30rpx;
  268. color: $font-color-light;
  269. padding-left: 20rpx;
  270. }
  271. .tit {
  272. flex-shrink: 0;
  273. width: 160rpx;
  274. font-size: 30rpx;
  275. color: $font-color-dark;
  276. }
  277. .input {
  278. flex: 1;
  279. font-size: 30rpx;
  280. color: $font-color-dark;
  281. padding-left: 20rpx;
  282. &.payColor {
  283. color: $color-red;
  284. }
  285. }
  286. .iconlocation {
  287. font-size: 36rpx;
  288. color: $font-color-light;
  289. }
  290. }
  291. .add-btn {
  292. display: flex;
  293. align-items: center;
  294. justify-content: center;
  295. width: 690rpx;
  296. height: 80rpx;
  297. margin: 60rpx auto;
  298. font-size: $font-lg;
  299. color: #fff;
  300. background-color: $base-color;
  301. border-radius: 10rpx;
  302. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  303. }
  304. /* 多条商品 */
  305. .order-item {
  306. display: flex;
  307. flex-direction: column;
  308. padding-left: 30rpx;
  309. background: #fff;
  310. margin-top: 16rpx;
  311. .goods-box {
  312. height: 160rpx;
  313. padding: 20rpx 0;
  314. white-space: nowrap;
  315. .goods-item {
  316. width: 120rpx;
  317. height: 120rpx;
  318. display: inline-block;
  319. margin-right: 24rpx;
  320. }
  321. .goods-img {
  322. display: block;
  323. width: 100%;
  324. height: 100%;
  325. }
  326. }
  327. /* 单条商品 */
  328. .goods-box-single {
  329. display: flex;
  330. padding: 20rpx 0;
  331. .goods-img {
  332. display: block;
  333. width: 120rpx;
  334. height: 120rpx;
  335. }
  336. .right {
  337. flex: 1;
  338. display: flex;
  339. flex-direction: column;
  340. padding: 0 30rpx 0 24rpx;
  341. overflow: hidden;
  342. .title {
  343. font-size: $font-base + 2rpx;
  344. color: $font-color-dark;
  345. line-height: 1;
  346. }
  347. .attr-box {
  348. font-size: $font-sm + 2rpx;
  349. color: $font-color-light;
  350. padding: 10rpx 12rpx;
  351. }
  352. .price {
  353. font-size: $font-base + 2rpx;
  354. color: $font-color-dark;
  355. &:before {
  356. content: '¥';
  357. font-size: $font-sm;
  358. margin: 0 2rpx 0 8rpx;
  359. }
  360. }
  361. }
  362. }
  363. }
  364. </style>