orderRefund.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. refund({
  100. text: obj.refund,
  101. uni: obj.orderId,
  102. refund_reason_wap_explain: obj.reason
  103. }).then(function(e) {
  104. uni.showToast({
  105. title:'提交成功',
  106. duration:1500
  107. })
  108. });
  109. }
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. page {
  115. background: $page-color-base;
  116. padding-top: 16rpx;
  117. }
  118. .orderDetial {
  119. .row {
  120. .input {
  121. text-align: right;
  122. }
  123. }
  124. }
  125. .row {
  126. display: flex;
  127. align-items: center;
  128. position: relative;
  129. padding: 0 30rpx;
  130. height: 110rpx;
  131. background: #fff;
  132. .refund {
  133. font-size: 30rpx;
  134. color: $font-color-dark;
  135. }
  136. .noRefund {
  137. font-size: 30rpx;
  138. color: $font-color-light;
  139. padding-left: 20rpx;
  140. }
  141. .tit {
  142. flex-shrink: 0;
  143. width: 120rpx;
  144. font-size: 30rpx;
  145. color: $font-color-dark;
  146. }
  147. .input {
  148. flex: 1;
  149. font-size: 30rpx;
  150. color: $font-color-dark;
  151. padding-left: 20rpx;
  152. &.payColor {
  153. color: $color-red;
  154. }
  155. }
  156. .iconlocation {
  157. font-size: 36rpx;
  158. color: $font-color-light;
  159. }
  160. }
  161. .add-btn {
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. width: 690rpx;
  166. height: 80rpx;
  167. margin: 60rpx auto;
  168. font-size: $font-lg;
  169. color: #fff;
  170. background-color: $base-color;
  171. border-radius: 10rpx;
  172. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  173. }
  174. /* 多条商品 */
  175. .order-item {
  176. display: flex;
  177. flex-direction: column;
  178. padding-left: 30rpx;
  179. background: #fff;
  180. margin-top: 16rpx;
  181. .goods-box {
  182. height: 160rpx;
  183. padding: 20rpx 0;
  184. white-space: nowrap;
  185. .goods-item {
  186. width: 120rpx;
  187. height: 120rpx;
  188. display: inline-block;
  189. margin-right: 24rpx;
  190. }
  191. .goods-img {
  192. display: block;
  193. width: 100%;
  194. height: 100%;
  195. }
  196. }
  197. /* 单条商品 */
  198. .goods-box-single {
  199. display: flex;
  200. padding: 20rpx 0;
  201. .goods-img {
  202. display: block;
  203. width: 120rpx;
  204. height: 120rpx;
  205. }
  206. .right {
  207. flex: 1;
  208. display: flex;
  209. flex-direction: column;
  210. padding: 0 30rpx 0 24rpx;
  211. overflow: hidden;
  212. .title {
  213. font-size: $font-base + 2rpx;
  214. color: $font-color-dark;
  215. line-height: 1;
  216. }
  217. .attr-box {
  218. font-size: $font-sm + 2rpx;
  219. color: $font-color-light;
  220. padding: 10rpx 12rpx;
  221. }
  222. .price {
  223. font-size: $font-base + 2rpx;
  224. color: $font-color-dark;
  225. &:before {
  226. content: '¥';
  227. font-size: $font-sm;
  228. margin: 0 2rpx 0 8rpx;
  229. }
  230. }
  231. }
  232. }
  233. }
  234. </style>