You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

apply-return-goods.vue 5.7KB

2 年之前
1 年之前
2 年之前
1 年之前
7 月之前
7 月之前
1 年之前
11 月之前
2 年之前
1 年之前
11 月之前
1 年之前
2 年之前
1 年之前
1 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
7 月之前
1 年之前
2 年之前
1 年之前
7 月之前
1 年之前
2 年之前
7 月之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
11 月之前
1 年之前
7 月之前
1 年之前
1 年之前
1 年之前
7 月之前
1 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
7 月之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
1 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <!-- 申请退货 -->
  2. <template>
  3. <view class="box">
  4. <form-builder :config="config" :formData="state.formData" @submit="submit" @radioChange="radioChange" />
  5. </view>
  6. </template>
  7. <script setup lang="ts">
  8. import { reactive } from "vue";
  9. import { onLoad } from "@dcloudio/uni-app";
  10. import { confirm, getOrderStatusName } from "@/utils/utils";
  11. import {requestNew } from "@/utils/network/request";
  12. import { commQueryCourier, orderReturn, outletList } from "@/utils/network/api";
  13. import { getItem, StorageKeys } from "@/utils/storage";
  14. import {
  15. getMailingAddress
  16. } from "@/subpackage/orders/js/publicRequest";
  17. const config = {
  18. submitName: "申请退货",
  19. titleWidth: 160,
  20. divider: true,
  21. address:""
  22. };
  23. const state = reactive({
  24. //订单信息
  25. orderInfo: {} as any,
  26. //退货类型: OFFLINE-线下 ON_LINE-线上
  27. returnMode: "ON_LINE",
  28. //网点列表
  29. outlets: [],
  30. //表单数据
  31. formData: [
  32. {
  33. title: "订单编号:",
  34. inputType: "number",
  35. type: 2,
  36. value: "id",
  37. hint: "订单编号",
  38. disabled: true,
  39. divider: true,
  40. },
  41. {
  42. title: "订单车牌号:",
  43. type: 2,
  44. value: "vehiclePlate",
  45. hint: "订单车牌号",
  46. disabled: true,
  47. divider: true,
  48. },
  49. {
  50. title: "订单状态:",
  51. type: 2,
  52. value: "orderStep",
  53. hint: "订单状态",
  54. disabled: true,
  55. divider: true,
  56. },
  57. {
  58. title: "退货方式:",
  59. type: 7,
  60. value: "returnMode",
  61. returnMode: "ON_LINE",
  62. star: true,
  63. required: true,
  64. divider: true,
  65. emptyHint: "请选择退货方式",
  66. itemData: [
  67. {
  68. checked: true,
  69. value: "ON_LINE",
  70. name: "线上",
  71. },
  72. // {
  73. // checked: false,
  74. // value: "OFFLINE",
  75. // name: "线下",
  76. // },
  77. ],
  78. },
  79. {
  80. title: "物流公司:",
  81. type: 4,
  82. value: "returnLogisticsCompany",
  83. required: true,
  84. star: true,
  85. hint: "请输入",
  86. divider: true,
  87. itemData: [],
  88. hide: false,
  89. emptyHint: "请选择物流公司",
  90. mode: "search",
  91. searchPickerVisible: false,
  92. },
  93. {
  94. title: "物流单号:",
  95. type: 2,
  96. value: "returnLogisticsNumber",
  97. required: true,
  98. maxlength: 20,
  99. hint: "请输入",
  100. emptyHint: "请输入物流单号",
  101. star: true,
  102. divider: true,
  103. hide: false,
  104. },
  105. {
  106. title: "退货网点编号:",
  107. type: 4,
  108. value: "returnNetworkName",
  109. required: true,
  110. star: true,
  111. hint: "请输入",
  112. emptyHint: "请选择退货网点",
  113. divider: true,
  114. itemData: [],
  115. hide: true,
  116. mode: "search",
  117. searchPickerVisible: false,
  118. },
  119. {
  120. title: "退货原因:",
  121. required: true,
  122. type: 5,
  123. vertical: 2,
  124. value: "returnReason",
  125. maxlength: 50,
  126. bg: true,
  127. star: true,
  128. hint: "请输入退货原因,限制50字以内",
  129. emptyHint: "请输入退货原因",
  130. },
  131. ],
  132. });
  133. /* 获取所有的快递公司 */
  134. const getLogisticsList = () => {
  135. const options = {
  136. type: 2,
  137. data: {},
  138. method: "POST",
  139. showLoading: true,
  140. };
  141. requestNew(commQueryCourier, options).then((res) => {
  142. const data = res;
  143. state.formData[4].itemData = data;
  144. });
  145. };
  146. /* 获取退货网点 */
  147. const getOutletList = () => {
  148. const options = {
  149. type: 2,
  150. data: {
  151. },
  152. method: "POST",
  153. showLoading: true,
  154. };
  155. requestNew(outletList, options).then((res) => {
  156. state.outlets = res;
  157. let nameList = [];
  158. state.outlets.map((item) => {
  159. nameList.push(item.name);
  160. });
  161. state.formData[6].itemData = nameList;
  162. });
  163. };
  164. //radio改变
  165. const radioChange = (e : any, item : any) => {
  166. if (item.value === "returnMode") {
  167. //退货方式
  168. state.returnMode = item.returnMode;
  169. state.formData[4].hide = state.returnMode === "ON_LINE" ? false : true;
  170. state.formData[5].hide = state.returnMode === "ON_LINE" ? false : true;
  171. state.formData[6].hide = state.returnMode === "ON_LINE" ? true : false;
  172. }
  173. };
  174. //提交退货申请
  175. const submit = (e : any) => {
  176. confirm(
  177. "是否确认退货?",
  178. () => {
  179. const curOutlet = state.outlets.find(
  180. (out) => out.name === e.returnNetworkName
  181. );
  182. const options = {
  183. type: 2,
  184. data: {
  185. id: state.orderInfo.id,
  186. returnMode: e.returnMode,
  187. // returnNetworkId: curOutlet == null ? "" : curOutlet.servicehallId,
  188. returnNetworkId: e.returnNetworkName,
  189. returnNetworkName: e.returnNetworkName,
  190. returnLogisticsCompany: e.returnLogisticsCompany,
  191. returnLogisticsNumber: e.returnLogisticsNumber,
  192. returnReason: e.returnReason,
  193. opId: getItem(StorageKeys.OpenId),
  194. address:config.address
  195. },
  196. method: "POST",
  197. showLoading: true,
  198. };
  199. requestNew(orderReturn, options).then((res) => {
  200. confirm(
  201. "您申办的ETC订单已申请退货,待审核,请到【查询服务】的【业务审核查询】查看进度",
  202. () => {
  203. uni.$emit("refreshOrder");
  204. uni.navigateBack({
  205. delta: 1
  206. })
  207. },
  208. "申请成功",
  209. false
  210. );
  211. });
  212. },
  213. "退货确认",
  214. true
  215. );
  216. };
  217. onLoad((option) => {
  218. state.orderInfo = JSON.parse(option.data);
  219. state.formData[0].hint = state.orderInfo.orderId;
  220. state.formData[1].hint = state.orderInfo.vehiclePlate;
  221. state.formData[2].hint = getOrderStatusName(state.orderInfo.orderStep);
  222. //获取物流公司
  223. getLogisticsList();
  224. //获取退货网点
  225. getOutletList();
  226. // getMailingAddress(state.orderInfo.orderId,state.orderInfo.id).then((address) => {
  227. // console.log("address",address)
  228. // config.address=address
  229. // })
  230. });
  231. </script>
  232. <style>
  233. page {
  234. background-color: #f3f3f3;
  235. padding-bottom: 30rpx;
  236. }
  237. </style>
  238. <style lang="scss" scoped>
  239. .box {
  240. margin: 20rpx 0rpx;
  241. background-color: white;
  242. padding: 0 20rpx 20rpx;
  243. }
  244. </style>