orderRefund.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  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"
  10. :key="goodsIndex">
  11. <image class="goods-img" :src="goodsItem.productInfo.image" mode="aspectFill"></image>
  12. <view class="right">
  13. <text class="title clamp">{{ goodsItem.productInfo.store_name }}</text>
  14. <text class="attr-box">{{ goodsItem.attrInfo ? goodsItem.attrInfo.suk : '' }} x
  15. {{ goodsItem.cart_num }}</text>
  16. <text class="price">{{ goodsItem.productInfo.price }}</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="orderDetial">
  21. <view class="row b-b flex">
  22. <text class="tit">订单总价</text>
  23. <view class="input">¥{{ item.total_price }}</view>
  24. </view>
  25. <view class="row b-b flex">
  26. <text class="tit">邮费</text>
  27. <view class="input">{{ item.pay_postage > 0 ? '¥' + item.pay_postage : '免邮费' }}</view>
  28. </view>
  29. <view class="row b-b flex" v-if="item.coupon_id > 0">
  30. <text class="tit">优惠券</text>
  31. <view class="input">-¥{{ item.coupon_price }}</view>
  32. </view>
  33. <view class="row b-b flex" v-if="item.use_integral > 0">
  34. <text class="tit">积分抵扣</text>
  35. <view class="input">-¥{{ item.use_integral }}</view>
  36. </view>
  37. <view class="row b-b flex">
  38. <text class="tit ">实付</text>
  39. <view class="input payColor">¥{{ item.pay_price }}</view>
  40. </view>
  41. </view>
  42. <view class="row b-b">
  43. <text class="tit">退款理由</text>
  44. <picker mode="selector" :range="value" @change="bindChange">
  45. <view class="refund" v-if="refund">{{ refund || '请选择退款理由' }}</view>
  46. <view class="noRefund" v-else>请选择退款理由</view>
  47. </picker>
  48. </view>
  49. <view class="row b-b" v-if="is_public ==1">
  50. <text class="tit">快递单号</text>
  51. <input class="input" type="text" v-model="refund_delivery_id" placeholder="请填写快递单号"
  52. placeholder-class="placeholder" />
  53. <image class="icon" @click="smsh" src="../../static/icon/sao.png" mode=""></image>
  54. </view>
  55. <view class="row b-b">
  56. <text class="tit">备注说明</text>
  57. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  58. </view>
  59. <button class="add-btn" @click="confirm">提交</button>
  60. </view>
  61. </template>
  62. <script>
  63. import {
  64. refund,
  65. refundReason,
  66. orderDetail
  67. } 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. is_public: 1,
  78. refund_delivery_id: '',
  79. };
  80. },
  81. onLoad(option) {
  82. this.orderId = option.id;
  83. this.refundReason();
  84. this.loadOrder();
  85. },
  86. methods: {
  87. // 切换选中事件
  88. bindChange(e) {
  89. this.refund = this.value[e.detail.value];
  90. },
  91. // 加载退款理由
  92. refundReason() {
  93. refundReason({}).then(e => {
  94. this.value = e.data;
  95. });
  96. },
  97. loadOrder() {
  98. const obj = this
  99. orderDetail({}, this.orderId).then(e => {
  100. this.item = e.data;
  101. console.log(e.data._status._title);
  102. if (e.data._status._title == "未发货") {
  103. obj.is_public = 0
  104. }
  105. console.log(obj.is_public);
  106. });
  107. },
  108. smsh() {
  109. // #ifdef H5
  110. // let wx = require('jweixin-module');
  111. // wx.scanQRCode({
  112. // needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  113. // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
  114. // success: function(res) {
  115. // this.refund_delivery_id = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  116. // }
  117. // });
  118. // #endif
  119. // #ifndef H5
  120. uni.scanCode({
  121. success: res => {
  122. this.refund_delivery_id = res.result;
  123. }
  124. });
  125. // #endif
  126. },
  127. //提交
  128. confirm() {
  129. let obj = this;
  130. if (!obj.refund) {
  131. uni.showModal({
  132. title: '错误',
  133. content: '请填写退货理由',
  134. showCancel: false
  135. });
  136. return false;
  137. }
  138. if (obj.is_public == 1) {
  139. if (!obj.refund_delivery_id) {
  140. return obj.$api.msg('请填写订单号');
  141. }
  142. }
  143. refund({
  144. refund_delivery_id: obj.refund_delivery_id,
  145. text: obj.refund,
  146. uni: obj.orderId,
  147. refund_reason_wap_explain: obj.reason
  148. }).then(function(e) {
  149. uni.showToast({
  150. title: '提交成功',
  151. duration: 1500
  152. });
  153. uni.switchTab({
  154. url: '/pages/user/user'
  155. })
  156. });
  157. }
  158. }
  159. };
  160. </script>
  161. <style lang="scss">
  162. page {
  163. background: $page-color-base;
  164. padding-top: 16rpx;
  165. }
  166. .orderDetial {
  167. .row {
  168. .input {
  169. text-align: right;
  170. }
  171. }
  172. }
  173. .row {
  174. display: flex;
  175. align-items: center;
  176. position: relative;
  177. padding: 0 30rpx;
  178. height: 110rpx;
  179. background: #fff;
  180. .icon {
  181. width: 40rpx;
  182. height: 40rpx;
  183. margin-left: 20rpx;
  184. }
  185. .refund {
  186. font-size: 30rpx;
  187. color: $font-color-dark;
  188. }
  189. .noRefund {
  190. font-size: 30rpx;
  191. color: $font-color-light;
  192. padding-left: 20rpx;
  193. }
  194. .tit {
  195. flex-shrink: 0;
  196. width: 120rpx;
  197. font-size: 30rpx;
  198. color: $font-color-dark;
  199. }
  200. .input {
  201. flex: 1;
  202. font-size: 30rpx;
  203. color: $font-color-dark;
  204. padding-left: 20rpx;
  205. &.payColor {
  206. color: $color-red;
  207. }
  208. }
  209. .iconlocation {
  210. font-size: 36rpx;
  211. color: $font-color-light;
  212. }
  213. }
  214. .add-btn {
  215. display: flex;
  216. align-items: center;
  217. justify-content: center;
  218. width: 690rpx;
  219. height: 80rpx;
  220. margin: 60rpx auto;
  221. font-size: $font-lg;
  222. color: #fff;
  223. background-color: $base-color;
  224. border-radius: 10rpx;
  225. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  226. }
  227. /* 多条商品 */
  228. .order-item {
  229. display: flex;
  230. flex-direction: column;
  231. padding-left: 30rpx;
  232. background: #fff;
  233. margin-top: 16rpx;
  234. .goods-box {
  235. height: 160rpx;
  236. padding: 20rpx 0;
  237. white-space: nowrap;
  238. .goods-item {
  239. width: 120rpx;
  240. height: 120rpx;
  241. display: inline-block;
  242. margin-right: 24rpx;
  243. }
  244. .goods-img {
  245. display: block;
  246. width: 100%;
  247. height: 100%;
  248. }
  249. }
  250. /* 单条商品 */
  251. .goods-box-single {
  252. display: flex;
  253. padding: 20rpx 0;
  254. .goods-img {
  255. display: block;
  256. width: 120rpx;
  257. height: 120rpx;
  258. }
  259. .right {
  260. flex: 1;
  261. display: flex;
  262. flex-direction: column;
  263. padding: 0 30rpx 0 24rpx;
  264. overflow: hidden;
  265. .title {
  266. font-size: $font-base + 2rpx;
  267. color: $font-color-dark;
  268. line-height: 1;
  269. }
  270. .attr-box {
  271. font-size: $font-sm + 2rpx;
  272. color: $font-color-light;
  273. padding: 10rpx 12rpx;
  274. }
  275. .price {
  276. font-size: $font-base + 2rpx;
  277. color: $font-color-dark;
  278. &:before {
  279. content: '¥';
  280. font-size: $font-sm;
  281. margin: 0 2rpx 0 8rpx;
  282. }
  283. }
  284. }
  285. }
  286. }
  287. </style>