orderRefund.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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" v-if="is_public ==1">
  56. <view class="tip">
  57. 退货地址:浙江省湖州市织里镇仁舍新街665号科洋园区3 栋4楼 小程序组收 13216517112
  58. </view>
  59. </view>
  60. <view class="row b-b">
  61. <text class="tit">备注说明</text>
  62. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  63. </view>
  64. <button class="add-btn" @click="confirm">提交</button>
  65. </view>
  66. </template>
  67. <script>
  68. import {
  69. refund,
  70. refundReason,
  71. orderDetail
  72. } from '@/api/order.js';
  73. export default {
  74. data() {
  75. return {
  76. refund: '', //退款理由
  77. reason: '', //备注
  78. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  79. orderId: '',
  80. item: {},
  81. listStyle: 2,
  82. is_public: 1,
  83. refund_delivery_id: '',
  84. };
  85. },
  86. onLoad(option) {
  87. this.orderId = option.id;
  88. this.refundReason();
  89. this.loadOrder();
  90. },
  91. methods: {
  92. // 切换选中事件
  93. bindChange(e) {
  94. this.refund = this.value[e.detail.value];
  95. },
  96. // 加载退款理由
  97. refundReason() {
  98. refundReason({}).then(e => {
  99. this.value = e.data;
  100. });
  101. },
  102. loadOrder() {
  103. const obj = this
  104. orderDetail({}, this.orderId).then(e => {
  105. this.item = e.data;
  106. console.log(e.data._status._title);
  107. if (e.data._status._title == "未发货") {
  108. obj.is_public = 0
  109. }
  110. console.log(obj.is_public);
  111. });
  112. },
  113. smsh() {
  114. // #ifdef H5
  115. // let wx = require('jweixin-module');
  116. // wx.scanQRCode({
  117. // needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
  118. // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
  119. // success: function(res) {
  120. // this.refund_delivery_id = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
  121. // }
  122. // });
  123. // #endif
  124. // #ifndef H5
  125. uni.scanCode({
  126. success: res => {
  127. this.refund_delivery_id = res.result;
  128. }
  129. });
  130. // #endif
  131. },
  132. //提交
  133. confirm() {
  134. let obj = this;
  135. if (!obj.refund) {
  136. uni.showModal({
  137. title: '错误',
  138. content: '请填写退货理由',
  139. showCancel: false
  140. });
  141. return false;
  142. }
  143. if (obj.is_public == 1) {
  144. if (!obj.refund_delivery_id) {
  145. return obj.$api.msg('请填写订单号');
  146. }
  147. }
  148. refund({
  149. refund_delivery_id: obj.refund_delivery_id,
  150. text: obj.refund,
  151. uni: obj.orderId,
  152. refund_reason_wap_explain: obj.reason
  153. }).then(function(e) {
  154. uni.showToast({
  155. title: '提交成功',
  156. duration: 1500
  157. });
  158. uni.switchTab({
  159. url: '/pages/user/user'
  160. })
  161. });
  162. }
  163. }
  164. };
  165. </script>
  166. <style lang="scss">
  167. page {
  168. background: $page-color-base;
  169. padding-top: 16rpx;
  170. }
  171. .orderDetial {
  172. .row {
  173. .input {
  174. text-align: right;
  175. }
  176. }
  177. }
  178. .row {
  179. display: flex;
  180. align-items: center;
  181. position: relative;
  182. padding: 0 30rpx;
  183. height: 110rpx;
  184. background: #fff;
  185. .icon {
  186. width: 40rpx;
  187. height: 40rpx;
  188. margin-left: 20rpx;
  189. }
  190. .refund {
  191. font-size: 30rpx;
  192. color: $font-color-dark;
  193. }
  194. .noRefund {
  195. font-size: 30rpx;
  196. color: $font-color-light;
  197. padding-left: 20rpx;
  198. }
  199. .tit {
  200. flex-shrink: 0;
  201. width: 120rpx;
  202. font-size: 30rpx;
  203. color: $font-color-dark;
  204. }
  205. .input {
  206. flex: 1;
  207. font-size: 30rpx;
  208. color: $font-color-dark;
  209. padding-left: 20rpx;
  210. &.payColor {
  211. color: $color-red;
  212. }
  213. }
  214. .iconlocation {
  215. font-size: 36rpx;
  216. color: $font-color-light;
  217. }
  218. }
  219. .add-btn {
  220. display: flex;
  221. align-items: center;
  222. justify-content: center;
  223. width: 690rpx;
  224. height: 80rpx;
  225. margin: 60rpx auto;
  226. font-size: $font-lg;
  227. color: #fff;
  228. background-color: $base-color;
  229. border-radius: 10rpx;
  230. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  231. }
  232. .tip {
  233. font-size: 24rpx;
  234. color: rgba(#fd3b39, 0.5);
  235. }
  236. /* 多条商品 */
  237. .order-item {
  238. display: flex;
  239. flex-direction: column;
  240. padding-left: 30rpx;
  241. background: #fff;
  242. margin-top: 16rpx;
  243. .goods-box {
  244. height: 160rpx;
  245. padding: 20rpx 0;
  246. white-space: nowrap;
  247. .goods-item {
  248. width: 120rpx;
  249. height: 120rpx;
  250. display: inline-block;
  251. margin-right: 24rpx;
  252. }
  253. .goods-img {
  254. display: block;
  255. width: 100%;
  256. height: 100%;
  257. }
  258. }
  259. /* 单条商品 */
  260. .goods-box-single {
  261. display: flex;
  262. padding: 20rpx 0;
  263. .goods-img {
  264. display: block;
  265. width: 120rpx;
  266. height: 120rpx;
  267. }
  268. .right {
  269. flex: 1;
  270. display: flex;
  271. flex-direction: column;
  272. padding: 0 30rpx 0 24rpx;
  273. overflow: hidden;
  274. .title {
  275. font-size: $font-base + 2rpx;
  276. color: $font-color-dark;
  277. line-height: 1;
  278. }
  279. .attr-box {
  280. font-size: $font-sm + 2rpx;
  281. color: $font-color-light;
  282. padding: 10rpx 12rpx;
  283. }
  284. .price {
  285. font-size: $font-base + 2rpx;
  286. color: $font-color-dark;
  287. &:before {
  288. content: '¥';
  289. font-size: $font-sm;
  290. margin: 0 2rpx 0 8rpx;
  291. }
  292. }
  293. }
  294. }
  295. }
  296. </style>