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 12KB

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