orderRefund.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <view class="content">
  3. <view class="order-item">
  4. <scroll-view v-if="item.cartInfo.length > 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="item.cartInfo.length === 1" 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="row b-b">
  19. <text class="tit flex-shrink-false">退款理由</text>
  20. <picker mode="selector" class="flex-grow-true" :range="value" @change="bindChange">
  21. <view class="refund" v-if="refund">{{ refund || '请选择退款理由' }}</view>
  22. <view class="noRefund" v-else>请选择退款理由</view>
  23. </picker>
  24. </view>
  25. <view class="row b-b">
  26. <text class="tit flex-shrink-false">备注说明</text>
  27. <input class="input flex-grow-true" type="text" v-model="reason" placeholder="请填写备注" placeholder-class="placeholder" />
  28. </view>
  29. <button class="add-btn" @click="confirm()">提交</button>
  30. </view>
  31. </template>
  32. <script>
  33. import { refund, refundReason, orderDetail } from '@/api/order.js';
  34. export default {
  35. data() {
  36. return {
  37. refund: '', //退款理由
  38. reason: '', //备注
  39. value: ['1', '2', '3', '4', '5', '6', '7', '8', 9, 10, 11, 12, 13],
  40. orderId: '',
  41. item: {},
  42. showloading: false
  43. };
  44. },
  45. onLoad(option) {
  46. this.orderId = option.id;
  47. this.refundReason();
  48. this.loadOrder();
  49. },
  50. methods: {
  51. // 切换选中事件
  52. bindChange(e) {
  53. this.refund = this.value[e.detail.value];
  54. console.log(e);
  55. },
  56. // 加载退款理由
  57. refundReason() {
  58. refundReason({}).then(e => {
  59. this.value = e.data;
  60. });
  61. },
  62. loadOrder() {
  63. orderDetail({}, this.orderId).then(e => {
  64. this.item = e.data;
  65. console.log(e);
  66. });
  67. },
  68. //提交
  69. confirm() {
  70. console.log('1111');
  71. let obj = this;
  72. if (!obj.refund) {
  73. obj.$api.msg('请选择退款理由');
  74. return;
  75. }
  76. obj.showloading = true;
  77. refund({
  78. text: obj.refund,
  79. uni: obj.orderId,
  80. refund_reason_wap_explain: obj.reason
  81. })
  82. .then(function(e) {
  83. obj.$api.msg('提交成功');
  84. setTimeout(() => {
  85. obj.showloading = false;
  86. uni.navigateBack();
  87. }, 500);
  88. })
  89. .catch(e => {
  90. obj.showloading = false;
  91. });
  92. }
  93. }
  94. };
  95. </script>
  96. <style lang="scss">
  97. page {
  98. background: $page-color-base;
  99. padding-top: 16rpx;
  100. }
  101. .row {
  102. display: flex;
  103. align-items: center;
  104. position: relative;
  105. padding: 0 30rpx;
  106. height: 110rpx;
  107. background: #fff;
  108. .refund {
  109. font-size: 30rpx;
  110. color: $font-color-dark;
  111. }
  112. .noRefund {
  113. font-size: 30rpx;
  114. color: $font-color-light;
  115. }
  116. .tit {
  117. flex-shrink: 0;
  118. width: 120rpx;
  119. font-size: 30rpx;
  120. color: $font-color-dark;
  121. margin-right: 10rpx;
  122. }
  123. .input {
  124. flex: 1;
  125. font-size: 30rpx;
  126. color: $font-color-dark;
  127. }
  128. .iconlocation {
  129. font-size: 36rpx;
  130. color: $font-color-light;
  131. }
  132. }
  133. .add-btn {
  134. display: flex;
  135. align-items: center;
  136. justify-content: center;
  137. width: 690rpx;
  138. height: 80rpx;
  139. margin: 60rpx auto;
  140. font-size: $font-lg;
  141. color: #fff;
  142. background-color: $base-color;
  143. border-radius: 10rpx;
  144. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  145. }
  146. /* 多条商品 */
  147. .order-item {
  148. display: flex;
  149. flex-direction: column;
  150. padding-left: 30rpx;
  151. background: #fff;
  152. margin-top: 16rpx;
  153. .goods-box {
  154. height: 160rpx;
  155. padding: 20rpx 0;
  156. white-space: nowrap;
  157. .goods-item {
  158. width: 120rpx;
  159. height: 120rpx;
  160. display: inline-block;
  161. margin-right: 24rpx;
  162. }
  163. .goods-img {
  164. display: block;
  165. width: 100%;
  166. height: 100%;
  167. }
  168. }
  169. /* 单条商品 */
  170. .goods-box-single {
  171. display: flex;
  172. padding: 20rpx 0;
  173. .goods-img {
  174. display: block;
  175. width: 120rpx;
  176. height: 120rpx;
  177. }
  178. .right {
  179. flex: 1;
  180. display: flex;
  181. flex-direction: column;
  182. padding: 0 30rpx 0 24rpx;
  183. overflow: hidden;
  184. .title {
  185. font-size: $font-base + 2rpx;
  186. color: $font-color-dark;
  187. line-height: 1;
  188. }
  189. .attr-box {
  190. font-size: $font-sm + 2rpx;
  191. color: $font-color-light;
  192. padding: 10rpx 12rpx;
  193. }
  194. .price {
  195. font-size: $font-base + 2rpx;
  196. color: $font-color-dark;
  197. &:before {
  198. content: '¥';
  199. font-size: $font-sm;
  200. margin: 0 2rpx 0 8rpx;
  201. }
  202. }
  203. }
  204. }
  205. }
  206. </style>