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.

useOrderSkip.ts 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. // 订单跳转统一工具类
  2. import { msg, navTo, interceptND } from "@/utils/utils";
  3. import { OrderStatus } from "@/datas/enum";
  4. import { OrderTypes } from "@/datas/enum";
  5. import { getItem, setItem } from "@/utils/storage";
  6. import { request } from "@/utils/network/request.js";
  7. import { gotoAgainUseOrderApi, finishUseOrderApi } from "@/utils/network/api.js";
  8. import { stringToJson } from "@/utils/network/encryption.js";
  9. import { jump } from "@/datas/9901Jump.js";
  10. import { deviceType } from "@/utils/network/difference";
  11. import {
  12. setItem,
  13. getItem,
  14. } from "@/utils/storage";
  15. export default function useOrderSkip() {
  16. const gotoOrderDetailsPay = (orderInfo) => {
  17. console.log(orderInfo, '跳转的数据');
  18. if (orderInfo.deviceType == deviceType) {
  19. const params = encodeURIComponent(JSON.stringify(orderInfo))
  20. jump("11", params)
  21. } else {
  22. navTo(`/subpackage/orders/product-detail?orderId=${orderInfo.orderId ? orderInfo.orderId : orderInfo.orderNo}&&clientFee=${getItem("clientFee")}&&id=${getItem("productId")}&&isValueCard=${getItem("isValueCard")}&&vehicleId=${orderInfo.vehicleId}`);
  23. }
  24. }
  25. //根据订单类型 跳转到不同的订单详情页面
  26. const gotoOrderDetails = (orderInfo, isWeiXin) => {
  27. console.log('输出内容=====', orderInfo)
  28. setItem("orderListData", orderInfo);
  29. navTo(`/subpackage/orders/order-details-new?id=${orderInfo.id}&appraise=${orderInfo.appraise}&isWeiXin=${isWeiXin}&reshipment=${orderInfo.reshipment}`);
  30. }
  31. //跳转到修改地址页面
  32. const gotoEditAddress = (orderInfo : any) => {
  33. console.log('修改地址', 123333, orderInfo.orderInfoExt);
  34. // const item = {
  35. // id: orderInfo.orderInfoExt.id ? orderInfo.orderInfoExt.id : '',
  36. // consignee: orderInfo.orderInfoExt.consignee ? orderInfo.orderInfoExt.consignee : '',
  37. // consigneeTel: orderInfo.orderInfoExt.consigneeTel ? orderInfo.orderInfoExt.consigneeTel : '',
  38. // region: orderInfo.orderInfoExt.region ? orderInfo.orderInfoExt.region : '',
  39. // address: orderInfo.orderInfoExt.address ? orderInfo.orderInfoExt.address : '',
  40. // postalCode: orderInfo.orderInfoExt.postalCode ? orderInfo.orderInfoExt.postalCode : '',
  41. // fromOrder: true, //是否来自订单
  42. // }
  43. navTo(`/subpackage/personal-center/setting/addressManager?fromOrder=true`);
  44. }
  45. //跳转到修改地址页面
  46. const gotoEditAddressNew = (orderInfo : any) => {
  47. console.log('修改地址', 123333, orderInfo.orderInfoExt);
  48. // const item = {
  49. // id: orderInfo.orderInfoExt.id ? orderInfo.orderInfoExt.id : '',
  50. // consignee: orderInfo.orderInfoExt.consignee ? orderInfo.orderInfoExt.consignee : '',
  51. // consigneeTel: orderInfo.orderInfoExt.consigneeTel ? orderInfo.orderInfoExt.consigneeTel : '',
  52. // region: orderInfo.orderInfoExt.region ? orderInfo.orderInfoExt.region : '',
  53. // address: orderInfo.orderInfoExt.address ? orderInfo.orderInfoExt.address : '',
  54. // postalCode: orderInfo.orderInfoExt.postalCode ? orderInfo.orderInfoExt.postalCode : '',
  55. // fromOrder: true, //是否来自订单
  56. // }
  57. navTo(`/subpackage/orders/editAddress?fromOrder=true&orderNo=${orderInfo.orderNo}`);
  58. }
  59. //取消订单
  60. const gotoCancelOrder = (orderInfo : any) => {
  61. console.log("取消订单", orderInfo)
  62. const item = {
  63. id: orderInfo.id,
  64. orderId: orderInfo.orderId ? orderInfo.orderId : orderInfo.orderNo,
  65. vehiclePlate: orderInfo.vehiclePlate,
  66. orderStep: orderInfo.orderStep,
  67. deviceType: orderInfo.deviceType
  68. }
  69. navTo(`/subpackage/orders/cancel-order?data=${JSON.stringify(item)}`);
  70. }
  71. //继续申请、修改资料
  72. const gotoEditUserOrUnitInfo = (orderInfo : any) => {
  73. console.log("********555555555555**********", orderInfo, OrderStatus["已支付/待签约"]);
  74. let url = '';
  75. if (orderInfo.orderStep == OrderStatus.完成填写基本信息 || orderInfo.orderStep == OrderStatus.待支付3 || orderInfo.orderStep === OrderStatus["审核不通过"]) {
  76. if (orderInfo.deviceType == deviceType) {
  77. const params = encodeURIComponent(JSON.stringify(orderInfo))
  78. jump("10", params)
  79. } else {
  80. url = orderInfo.userType === 'PERSONAL_USER' ? '/subpackage/orders/opening-account-people' : '/subpackage/orders/opening-account-unit';
  81. }
  82. } else if (orderInfo.orderStep === OrderStatus["完成个人/单位信息上传"]) {
  83. url = '/subpackage/orders/car-release';
  84. } else if (orderInfo.orderStep === OrderStatus.完成车辆信息上传 && orderInfo.isValueCard != 1) {
  85. url = `/subpackage/orders/release-products`;
  86. } else if (orderInfo.orderStep === OrderStatus.待加购权益) {
  87. navTo(`/subpackage/orders/interestsList?orderId=${orderInfo.orderId}&&clientFee=${getItem("clientFee")}&&id=${getItem("productId")}`);
  88. } else if (orderInfo.orderStep === OrderStatus["完成车辆信息上传/待支付"]) {
  89. if (orderInfo.deviceType == deviceType) {
  90. const params = encodeURIComponent(JSON.stringify(orderInfo))
  91. jump("11", params)
  92. } else {
  93. url = '/subpackage/orders/order-payment';
  94. }
  95. } else if (orderInfo.orderStep === OrderStatus["已支付/待签约"]) { //修改资料
  96. if (orderInfo.deviceType == deviceType) {
  97. const params = encodeURIComponent(JSON.stringify(orderInfo))
  98. jump("12", params)
  99. } else {
  100. url = '/subpackage/orders/release-products';
  101. }
  102. }
  103. // if (orderInfo.orderStep === OrderStatus["审核不通过"]) { //修改资料
  104. // url = '/subpackage/orders/changeInformation';
  105. // } else
  106. console.log("url", url)
  107. navTo(`${url}?orderId=${orderInfo.orderId ? orderInfo.orderId : orderInfo.orderNo}&clientFee=${orderInfo.amount}&id=${orderInfo.productId}&vehiclePlateColor=${orderInfo.vehiclePlateColor}&fromOrder=true&vanType=${orderInfo.type ? orderInfo.type : orderInfo.vanType}&userType=${orderInfo.userType === 'PERSONAL_USER' ? '1' : '2'}&vehicleId=${orderInfo.vehicleId}`);
  108. }
  109. //确认收货
  110. const gotoConfirmReceipt = (orderInfo : any) => {
  111. // interceptND(orderInfo.vehicleId).then(()=>{
  112. const item = {
  113. id: orderInfo.id,
  114. orderId: orderInfo.orderNo,
  115. vehiclePlate: orderInfo.vehiclePlate,
  116. orderStep: orderInfo.orderStep,
  117. cardId: orderInfo.cardId,
  118. obuId: orderInfo.obuId,
  119. }
  120. console.log('orderInfo==',orderInfo)
  121. navTo(`/subpackage/orders/order-confirm-receipt?id=${orderInfo.orderNo}`)
  122. // })
  123. }
  124. //去支付-选择产品
  125. const gotoPay = (orderInfo : any) => {
  126. const data = {
  127. orderId: orderInfo.orderId,
  128. amount: orderInfo.amount,
  129. productId: orderInfo.productId,
  130. }
  131. navTo(`/subpackage/orders/payment?data=${JSON.stringify(data)}`);
  132. }
  133. //申请退货
  134. const gotoReturnOrder = (orderInfo : any) => {
  135. if (orderInfo.deviceType == deviceType) {
  136. const params = encodeURIComponent(JSON.stringify(orderInfo))
  137. jump("8", params)
  138. } else {
  139. const data = {
  140. id: orderInfo.id,
  141. orderId: orderInfo.orderNo,
  142. vehiclePlate: orderInfo.vehiclePlate,
  143. orderStep: orderInfo.orderStep,
  144. }
  145. console.log('输出内容',data)
  146. navTo(`/subpackage/orders/apply-return-goods?data=${JSON.stringify(data)}`);
  147. }
  148. }
  149. //申请换货
  150. const gotoExchangeOrder = (orderInfo : any) => {
  151. if (orderInfo.deviceType == deviceType) {
  152. const params = encodeURIComponent(JSON.stringify(orderInfo))
  153. jump("7", params)
  154. } else {
  155. navTo(`/subpackage/orders/apply-ex-goods-step1?orderId=${orderInfo.orderNo}&id=${orderInfo.id}`);
  156. }
  157. }
  158. //申请补货
  159. const gotoReplenishmentOrder = (orderInfo : any) => {
  160. uni.showModal({
  161. title: '提示',
  162. content: '补换订单审核时效:设备签收后的2个自然日完成审核,审核通过后请关注订单物流单号',
  163. success: function (res) {
  164. if (res.confirm) {
  165. if (orderInfo.deviceType == deviceType) {
  166. const params = encodeURIComponent(JSON.stringify(orderInfo))
  167. jump("9", params)
  168. }
  169. } else if (res.cancel) {
  170. console.log('用户点击取消');
  171. }
  172. }
  173. });
  174. }
  175. //去激活订单
  176. const gotoActiveOrder = (orderInfo : any) => {
  177. console.log("去激活订单", orderInfo)
  178. if (orderInfo.deviceType == deviceType) {
  179. const params = encodeURIComponent(JSON.stringify(orderInfo))
  180. jump("14", params)
  181. } else {
  182. navTo(`/subpackage/after-sale/activation/operation-tips?id=${orderInfo.id}&orderId=${orderInfo.orderId ? orderInfo.orderId : orderInfo.orderNo}&cardStatus=${orderInfo.cardStatus}&obuStatus=${orderInfo.obuStatus}&transfer=${orderInfo.transfer}`);
  183. }
  184. }
  185. //新办订单-去评价
  186. const gotoEvaluateOrder = (orderInfo : any) => {
  187. navTo(`/subpackage/orders/order-evaluate?id=${orderInfo.id}`);
  188. }
  189. //新办订单-去评价 发行产品,业务满意度评价
  190. const gotoEvaluateProduct = (orderInfo : any) => {
  191. navTo(`/subpackage/orders/order-evaluate-product?id=${orderInfo.id}&orderId=${orderInfo.orderId}`);
  192. }
  193. //新办订单-去评价 业务办理满意度,业务员满意度
  194. const gotoEvaluateSalesman = (orderInfo : any) => {
  195. navTo(`/subpackage/orders/order-evaluate-salesman?id=${orderInfo.id}&orderId=${orderInfo.orderId}`);
  196. }
  197. //查看物流
  198. const gotoCheckLogistics = (orderInfo : any) => {
  199. navTo(`/subpackage/orders/order-detail-logistics?orderInfo=${encodeURIComponent(JSON.stringify(orderInfo))}`);
  200. }
  201. //换卡、换签、同时换卡换签订单支付确认页面
  202. const gotoCardSignPay = (orderInfo : any) => {
  203. navTo(`/subpackage/orders/order-card-sign-payment?id=${orderInfo.id}`);
  204. }
  205. //重新申请ETC注销
  206. const gotoLogoffETC = (orderInfo : any) => {
  207. navTo(`/subpackage/after-sale/ETC-log-off/log-off-confirm?orderId=${orderInfo.orderId}`);
  208. }
  209. //车辆信息变更-信息重写
  210. const gotoEditCarWriteInfo = (orderInfo : any) => {
  211. navTo(`/pages/bluetooth/bluetooth?routeType=3`);
  212. }
  213. //车辆信息变更-重新申请
  214. const gotoEditCarApplyAgain = (orderInfo : any) => {
  215. //跳转到车辆信息变更界面
  216. navTo(`/subpackage/personal-center/setting/car-information/car-change`);
  217. }
  218. //去签约
  219. const gotoOrderSign = (orderInfo : any) => {
  220. if (orderInfo.deviceType == deviceType) {
  221. const params = encodeURIComponent(JSON.stringify(orderInfo))
  222. jump("12", params)
  223. } else {
  224. //跳转到车辆信息变更界面
  225. // #ifdef MP-ALIPAY
  226. navTo(`/subpackage/orders/release-products?orderId=${orderInfo.orderId ? orderInfo.orderId : orderInfo.orderNo}`);
  227. // #endif
  228. // #ifdef MP-WEIXIN
  229. navTo(`/subpackage/orders/release-products?orderId=${orderInfo.orderId ? orderInfo.orderId : orderInfo.orderNo}&&id=${orderInfo.id}&&clientFee=${orderInfo.amount}`);
  230. // #endif
  231. }
  232. }
  233. //再次使用订单
  234. const gotoAgainUseOrder = (orderInfo : any) => {
  235. uni.showModal({
  236. title: '温馨提示',
  237. content: '确定再次使用订单',
  238. success: function (res) {
  239. if (res.confirm) {
  240. const options = {
  241. type: 2,
  242. data: {
  243. orderId: orderInfo.orderId,
  244. orderSource: "WECHAT",
  245. openId: getItem('openId'),
  246. },
  247. method: "POST",
  248. showLoading: true,
  249. };
  250. request(gotoAgainUseOrderApi, options).then((res) => {
  251. const data = stringToJson(res.bizContent);
  252. // 刷新本页面
  253. console.log("再次使用订单", data)
  254. uni.reLaunch({
  255. url: `/pages/order/order?index=${0}`
  256. })
  257. });
  258. } else if (res.cancel) {
  259. console.log('用户点击取消');
  260. }
  261. }
  262. });
  263. }
  264. // 结束订单
  265. const closeOrder = (orderInfo : any) => {
  266. uni.showModal({
  267. title: '温馨提示',
  268. content: '订单结束后,30天内可申请再次使用',
  269. success: function (res) {
  270. if (res.confirm) {
  271. const options = {
  272. type: 2,
  273. data: {
  274. orderId: orderInfo.orderId,
  275. orderSource: "WECHAT",
  276. openId: getItem('openId'),
  277. },
  278. method: "POST",
  279. showLoading: true,
  280. };
  281. request(finishUseOrderApi, options).then((res) => {
  282. const data = stringToJson(res.bizContent);
  283. // 刷新本页面
  284. console.log("结束订单", orderInfo)
  285. uni.reLaunch({
  286. url: `/pages/order/order?index=${0}`
  287. })
  288. });
  289. } else if (res.cancel) {
  290. console.log('用户点击取消');
  291. }
  292. }
  293. });
  294. }
  295. //异地-邮寄地址填写
  296. const gotoAddressOrder = (orderInfo : any) => {
  297. if (orderInfo.deviceType == deviceType) {
  298. const params = encodeURIComponent(JSON.stringify(orderInfo))
  299. jump("13", params)
  300. }
  301. }
  302. // 异地-去下单
  303. const placeAnOrder = (orderInfo : any) => {
  304. console.log("orderInfo", orderInfo)
  305. if (orderInfo.deviceType == deviceType) {
  306. const params = encodeURIComponent(JSON.stringify(orderInfo))
  307. jump("18", params)
  308. }
  309. }
  310. return {
  311. gotoEditAddress, gotoEditAddressNew, gotoCancelOrder, gotoEditUserOrUnitInfo,
  312. gotoConfirmReceipt, gotoCheckLogistics, gotoEvaluateOrder, gotoEvaluateProduct, gotoEvaluateSalesman,
  313. gotoActiveOrder, gotoReturnOrder, gotoExchangeOrder, gotoPay,
  314. gotoOrderDetails, gotoLogoffETC, gotoEditCarWriteInfo,
  315. gotoEditCarApplyAgain, gotoCardSignPay, gotoAgainUseOrder, gotoOrderDetailsPay, gotoOrderSign, closeOrder,
  316. gotoReplenishmentOrder, gotoAddressOrder, placeAnOrder
  317. }
  318. }