return-delivery.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <s-layout title="退货物流">
  3. <view>
  4. <form @submit="subRefund" report-submit='true'>
  5. <view class='apply-return'>
  6. <view class='list borRadius14'>
  7. <view class='item acea-row row-between-wrapper' style="display: flex;align-items: center;">
  8. <view>物流公司</view>
  9. <picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex"
  10. :range="state.expresses" range-key="name">
  11. <view class="picker acea-row row-between-wrapper " style="display: flex;align-items: center;">
  12. <view class='reason'>{{ state.expresses[state.expressIndex]?.name }}</view>
  13. <!-- TODO 非繁人:这里样式有问题,少了 > 按钮 -->
  14. <image src="@/static/icon/select-icon.png" class="select-icon" />
  15. </view>
  16. </picker>
  17. </view>
  18. <view class='item textarea acea-row row-between' style="display: flex;align-items: center;">
  19. <view>物流单号</view>
  20. <input placeholder='请填写物流单号' class='num' name="logisticsNo"
  21. placeholder-class='placeholder' />
  22. </view>
  23. <button class='returnBnt bg-color ss-reset-button ui-BG-Main-Gradient sub-btn'
  24. form-type="submit"
  25. style="background: linear-gradient(90deg,var(--ui-BG-Main),var(--ui-BG-Main-gradient))!important">提交</button>
  26. </view>
  27. </view>
  28. </form>
  29. </view>
  30. </s-layout>
  31. </template>
  32. <script setup>
  33. import {
  34. onLoad
  35. } from '@dcloudio/uni-app';
  36. import {
  37. reactive
  38. } from 'vue';
  39. import sheep from '@/sheep';
  40. import AfterSaleApi from '@/sheep/api/trade/afterSale';
  41. import DeliveryApi from '@/sheep/api/trade/delivery';
  42. const state = reactive({
  43. id: 0, // 售后编号
  44. expressIndex: 0, // 选中的 expresses 下标
  45. expresses: [], // 可选的快递列表
  46. })
  47. function bindPickerChange(e) {
  48. state.expressIndex = e.detail.value;
  49. }
  50. async function subRefund(e) {
  51. if(!state.expresses[state.expressIndex].id){
  52. sheep.$helper.toast(`请选择物流公司`);
  53. return false
  54. }
  55. if(!e.detail.value.logisticsNo){
  56. sheep.$helper.toast(`请填写物流单号`);
  57. return false
  58. }
  59. let data = {
  60. id: state.id,
  61. logisticsId: state.expresses[state.expressIndex].id,
  62. logisticsNo: e.detail.value.logisticsNo,
  63. };
  64. const {
  65. code
  66. } = await AfterSaleApi.deliveryAfterSale(data);
  67. if (code !== 0) {
  68. return;
  69. }
  70. uni.showToast({
  71. title: '填写退货成功',
  72. });
  73. sheep.$router.go('/pages/order/aftersale/detail', {
  74. id: state.id
  75. });
  76. }
  77. // 获得快递物流列表
  78. async function getExpressList() {
  79. const {
  80. code,
  81. data
  82. } = await DeliveryApi.getDeliveryExpressList();
  83. if (code !== 0) {
  84. return;
  85. }
  86. state.expresses = data;
  87. state.expresses.unshift({
  88. "id": 0,
  89. "name": "请选择"
  90. },)
  91. }
  92. onLoad(options => {
  93. if (!options.id) {
  94. sheep.$helper.toast(`缺少订单信息,请检查`);
  95. return
  96. }
  97. state.id = options.id;
  98. // 获得快递物流列表
  99. getExpressList();
  100. })
  101. </script>
  102. <style lang="scss" scoped>
  103. .apply-return {
  104. padding: 20rpx 30rpx 70rpx 30rpx;
  105. }
  106. .apply-return .list {
  107. background-color: #fff;
  108. margin-top: 18rpx;
  109. padding: 0 24rpx 70rpx 24rpx;
  110. }
  111. .apply-return .list .item {
  112. min-height: 90rpx;
  113. border-bottom: 1rpx solid #eee;
  114. font-size: 30rpx;
  115. color: #333;
  116. }
  117. .apply-return .list .item .num {
  118. color: #282828;
  119. margin-left: 27rpx;
  120. // width: 227rpx;
  121. // text-align: right;
  122. }
  123. .apply-return .list .item .num .picker .reason {
  124. width: 14rem;
  125. }
  126. .apply-return .list .item .num .picker .iconfont {
  127. color: #666;
  128. font-size: 30rpx;
  129. margin-top: 2rpx;
  130. }
  131. .select-icon {
  132. width:30rpx;
  133. height:30rpx;
  134. }
  135. .apply-return .list .item.textarea {
  136. padding: 24rpx 0;
  137. }
  138. .apply-return .list .item textarea {
  139. height: 100rpx;
  140. font-size: 30rpx;
  141. }
  142. .apply-return .list .item .placeholder {
  143. color: #bbb;
  144. }
  145. .apply-return .list .item .title {
  146. height: 95rpx;
  147. width: 100%;
  148. }
  149. .apply-return .list .item .title .tip {
  150. font-size: 30rpx;
  151. color: #bbb;
  152. }
  153. .apply-return .list .item .upload {
  154. padding-bottom: 36rpx;
  155. }
  156. .apply-return .list .item .upload .pictrue {
  157. border-radius: 14rpx;
  158. margin: 22rpx 23rpx 0 0;
  159. width: 156rpx;
  160. height: 156rpx;
  161. position: relative;
  162. font-size: 24rpx;
  163. color: #bbb;
  164. }
  165. .apply-return .list .item .upload .pictrue:nth-of-type(4n) {
  166. margin-right: 0;
  167. }
  168. .apply-return .list .item .upload .pictrue image {
  169. width: 100%;
  170. height: 100%;
  171. border-radius: 14rpx;
  172. }
  173. .apply-return .list .item .upload .pictrue .icon-guanbi1 {
  174. position: absolute;
  175. font-size: 45rpx;
  176. top: -10rpx;
  177. right: -10rpx;
  178. }
  179. .apply-return .list .item .upload .pictrue .icon-icon25201 {
  180. color: #bfbfbf;
  181. font-size: 50rpx;
  182. }
  183. .apply-return .list .item .upload .pictrue:nth-last-child(1) {
  184. border: 1rpx solid #ddd;
  185. box-sizing: border-box;
  186. }
  187. .apply-return .returnBnt {
  188. font-size: 32rpx;
  189. color: #fff;
  190. width: 100%;
  191. height: 86rpx;
  192. border-radius: 50rpx;
  193. text-align: center;
  194. line-height: 86rpx;
  195. margin: 43rpx auto;
  196. }
  197. </style>