orderRefund.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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="row b-b">
  48. <text class="tit">备注说明</text>
  49. <input class="input" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  50. </view>
  51. <button class="add-btn" @click="confirm">提交</button>
  52. </view>
  53. </template>
  54. <script>
  55. import { refund, refundReason, orderDetail } from '@/api/order.js';
  56. export default {
  57. data() {
  58. return {
  59. refund: '', //退款理由
  60. reason: '', //备注
  61. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  62. orderId: '',
  63. item: {},
  64. listStyle: 2
  65. };
  66. },
  67. onLoad(option) {
  68. this.orderId = option.id;
  69. this.refundReason();
  70. this.loadOrder();
  71. },
  72. methods: {
  73. // 切换选中事件
  74. bindChange(e) {
  75. this.refund = this.value[e.detail.value];
  76. },
  77. // 加载退款理由
  78. refundReason() {
  79. refundReason({}).then(e => {
  80. this.value = e.data;
  81. });
  82. },
  83. loadOrder() {
  84. orderDetail({}, this.orderId).then(e => {
  85. this.item = e.data;
  86. });
  87. },
  88. //提交
  89. confirm() {
  90. let obj = this;
  91. if (!obj.refund) {
  92. uni.showModal({
  93. title: '错误',
  94. content: '请填写退货理由',
  95. showCancel: false
  96. });
  97. return false;
  98. }
  99. uni.showLoading({
  100. title: '提交中...',
  101. mask: true
  102. })
  103. refund({
  104. text: obj.refund,
  105. uni: obj.orderId,
  106. refund_reason_wap_explain: obj.reason
  107. }).then(function(e) {
  108. uni.hideLoading()
  109. uni.showToast({
  110. title:'提交成功',
  111. duration:1500
  112. })
  113. }).catch( err => {
  114. uni.hideLoading()
  115. console.log(err)
  116. });
  117. }
  118. }
  119. };
  120. </script>
  121. <style lang="scss">
  122. page {
  123. background: $page-color-base;
  124. padding-top: 16rpx;
  125. }
  126. .orderDetial {
  127. .row {
  128. .input {
  129. text-align: right;
  130. }
  131. }
  132. }
  133. .row {
  134. display: flex;
  135. align-items: center;
  136. position: relative;
  137. padding: 0 30rpx;
  138. height: 110rpx;
  139. background: #fff;
  140. .refund {
  141. font-size: 30rpx;
  142. color: $font-color-dark;
  143. padding-left: 20rpx;
  144. }
  145. .noRefund {
  146. font-size: 30rpx;
  147. color: $font-color-light;
  148. padding-left: 20rpx;
  149. }
  150. .tit {
  151. flex-shrink: 0;
  152. width: 120rpx;
  153. font-size: 30rpx;
  154. color: $font-color-dark;
  155. }
  156. .input {
  157. flex: 1;
  158. font-size: 30rpx;
  159. color: $font-color-dark;
  160. padding-left: 20rpx;
  161. &.payColor {
  162. color: $color-red;
  163. }
  164. }
  165. .iconlocation {
  166. font-size: 36rpx;
  167. color: $font-color-light;
  168. }
  169. }
  170. .add-btn {
  171. display: flex;
  172. align-items: center;
  173. justify-content: center;
  174. width: 690rpx;
  175. height: 80rpx;
  176. margin: 60rpx auto;
  177. font-size: $font-lg;
  178. color: #fff;
  179. background-color: $base-color;
  180. border-radius: 10rpx;
  181. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  182. }
  183. /* 多条商品 */
  184. .order-item {
  185. display: flex;
  186. flex-direction: column;
  187. padding-left: 30rpx;
  188. background: #fff;
  189. margin-top: 16rpx;
  190. .goods-box {
  191. height: 160rpx;
  192. padding: 20rpx 0;
  193. white-space: nowrap;
  194. .goods-item {
  195. width: 120rpx;
  196. height: 120rpx;
  197. display: inline-block;
  198. margin-right: 24rpx;
  199. }
  200. .goods-img {
  201. display: block;
  202. width: 100%;
  203. height: 100%;
  204. }
  205. }
  206. /* 单条商品 */
  207. .goods-box-single {
  208. display: flex;
  209. padding: 20rpx 0;
  210. .goods-img {
  211. display: block;
  212. width: 120rpx;
  213. height: 120rpx;
  214. }
  215. .right {
  216. flex: 1;
  217. display: flex;
  218. flex-direction: column;
  219. padding: 0 30rpx 0 24rpx;
  220. overflow: hidden;
  221. .title {
  222. font-size: $font-base + 2rpx;
  223. color: $font-color-dark;
  224. line-height: 1;
  225. }
  226. .attr-box {
  227. font-size: $font-sm + 2rpx;
  228. color: $font-color-light;
  229. padding: 10rpx 12rpx;
  230. }
  231. .price {
  232. font-size: $font-base + 2rpx;
  233. color: $font-color-dark;
  234. &:before {
  235. content: '¥';
  236. font-size: $font-sm;
  237. margin: 0 2rpx 0 8rpx;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. </style>