123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426 |
- import Api from "../../../api/index.js"
- import { requestFnc } from "../../../utils/request.js"
- import { getStore, formatDate, dateFtt } from "../../../utils/index.js"
- import {
- orderStatusMap,
- afterTypeMap,
- courierCompanyList,
- vehicleTypeMap,
- plateColorToColorMap,
- afterSalesTypeMap,
- } from "../../../utils/systemConstant"
-
- Page({
- data: {
- current: 1,
-
- showReback: false,
-
- courierNo: "",
- company: "",
- courierCompany: "",
- showCompany: false,
- companyList: courierCompanyList,
-
- orderType: "", // 新办、售后
- afterType: "", // 退、换、补
- orderStatus: "", //
-
- reasonText: "",
- isLoading: false,
-
- sendType: "1",
- expressName: "线上快递邮寄",
- showNetWork: false,
- selectAddr: false,
- branchNoDetail: "",
- branchName: "",
- branchAddress: "",
- latitude: "",
- longitude: "",
- branchNo: "",
- branchWorktime: "",
- branchLinkPhone: "",
- branchLabel: "",
- netWorkArea: {},
- },
-
- onLoad: function (options) {
- const afterType = getStore("afterType")
- const orderStatus = getStore("orderStatus")
-
- let orderTypeText = orderStatusMap.get(orderStatus + "")
- let showTip = false
- let statusTag = "1"
- let current = 1
- if (
- orderStatus == "1" ||
- orderStatus == "7" ||
- orderStatus == "8" ||
- orderStatus == "9"
- ) {
- current = 2
- } else if (
- orderStatus == "2" ||
- orderStatus == "3" ||
- orderStatus == "10"
- ) {
- current = 3
- } else if (orderStatus == "11" || orderStatus == "4") {
- current = 4
- } else if (
- orderStatus == "12" ||
- orderStatus == "13" ||
- orderStatus == "14" ||
- orderStatus == "6" ||
- orderStatus == "15"
- ) {
- current = 6
- statusTag = "3"
- }
- if (orderStatus == "3") {
- // 审核不通过
- showTip = true
- statusTag = "2"
- }
- console.log("当前 current ---", current, orderStatus)
- let btnName = "返回首页"
- if (
- (afterType == "7" && orderStatus == "13") ||
- (afterType == "9" && orderStatus == "14")
- ) {
- // 换补完成
- btnName = "激活"
- }
- const businessType = afterTypeMap.get(afterType) + "申请"
- const afterOrderType = afterSalesTypeMap.get(getStore("afterOrderType"))
- console.log("设备类型 ----", afterOrderType)
- this.setData({
- orderType: getStore("orderType"),
- orderStatus,
- afterType,
- current,
- orderTypeText,
- showTip,
- statusTag,
- btnName,
- businessType,
- afterOrderType,
- })
- if ((afterType == "7" || afterType == "8") && orderStatus == "10") {
- this.setData({
- showReback: true,
- })
- this.getRebackAddress()
- }
- this.getOrderDetail()
- },
- // 打开腾讯地图
- goMap() {
- let params = {
- branchName: this.data.branchName,
- branchAddress: this.data.branchAddress,
- branchWorktime: this.data.branchWorktime,
- branchLinkPhone: this.data.branchLinkPhone,
- branchLabel: this.data.branchLabel,
- latitude: Number(this.data.latitude),
- longitude: Number(this.data.longitude),
- }
- wx.navigateTo({
- url: "plugin://issuer-plugin/map?params=" + JSON.stringify(params),
- })
- },
- // 选择网点
- selectNetWork(e) {
- let { network = {}, address = {} } = e.detail
- this.setData({
- branchName: network.branchName,
- branchAddress: network.addr,
- latitude: network.latitude,
- longitude: network.longitude,
- branchNo: network.branchNo,
- branchWorktime: network.branchTime,
- branchLinkPhone: network.branchPhone,
- branchLabel: network.label,
- showNetWork: false,
- selectAddr: true,
- netWorkArea: address,
- })
- },
- deleteImg(event) {
- const index = event.detail.index
- const files = Object.assign(this.data.fileList)
- files.splice(index, 1)
- console.log("删除图片 ---", event, index, files)
- this.setData({
- fileList: files,
- })
- },
- tap() {
- this.setData({
- showCompany: true,
- })
- },
- onCancel() {
- this.setData({
- showCompany: false,
- })
- },
- onConfirm(e) {
- console.log("确认公司 --", e)
- this.setData({
- showCompany: false,
- company: e.detail.value.text,
- courierCompany: e.detail.value.value,
- })
- },
- getRebackAddress() {
- let params = {
- filename: Api.getRebackAddress.filename,
- data: {
- openId: getStore("openId"),
- plateNum: getStore("plateNum"),
- plateColor: getStore("plateColor"),
- },
- }
- requestFnc(Api.getRebackAddress.url, params, (res) => {
- console.log("获取地址 ---", res)
- this.setData({
- rebackAddress:
- res.provinceName +
- res.cityName +
- res.areaName +
- res.address,
- reLinkPhone: res.linkPhone,
- reLinkman: res.linkman,
- })
- cb && cb()
- })
- },
- getOrderDetail() {
- let params = {
- filename: Api.getOrderDetail.filename,
- data: {
- accessToken: getStore("accessToken"),
- accountId: getStore("accountId"),
- priOrderNo: getStore("appOrderNo"),
- },
- }
- requestFnc(Api.getOrderDetail.url, params, (res) => {
- console.log("获取订单详情 ---", res)
- const {
- plateNum,
- plateColor,
- address,
- auditRemark,
- linkman,
- linkName,
- linkPhone,
- orderNo,
- orderTime,
- orderDealReasonDesc,
- orderDealReason,
- branchNo,
- orderSendType,
- } = res
- this.setData({
- plateNum,
- plateColor,
- plateCar:
- plateNum +
- " 【" +
- plateColorToColorMap.get(plateColor + "") +
- "】",
- address,
- auditRemark,
- linkman: linkman || linkName,
- linkPhone,
- orderNo,
- orderTime: orderTime.replace("T", " "),
- orderDealReasonDesc,
- orderDealReason,
- branchNoDetail: branchNo,
- expressName:
- orderSendType == "1" ? "线上快递邮寄" : "线下网点自提",
- sendType: `${orderSendType}`,
- })
- this.getReason()
- })
- },
-
- getReason() {
- const afterType = getStore("afterType")
- let type = ""
- if (afterType == "7") {
- // 换货申请
- type = 3
- } else if (afterType == "8") {
- // 退货申请
- type = 2
- } else if (afterType == "9") {
- // 补货申请
- type = 4
- }
- let params = {
- filename: Api.getOffReason.filename,
- data: {
- accountId: getStore("accountId"),
- type,
- },
- }
- requestFnc(Api.getOffReason.url, params, (res) => {
- console.log("获取原因 ---", res, this.data.orderDealReason)
- let reasonText = res.find(
- (e) => e.code == this.data.orderDealReason
- )
- ? res.find((e) => e.code == this.data.orderDealReason).name
- : ""
- this.data.orderDealReason
- this.setData({
- reasonText,
- })
- })
- },
-
- submitAction() {
- const {
- remark,
- linkman,
- linkPhone,
- address,
- orderType,
- afterType,
- courierNo,
- courierCompany,
- afterOrderType,
- } = this.data
- if (!courierNo) {
- return wx.showToast({
- title: "请输入快递单号",
- icon: "none",
- duration: 2000,
- })
- }
- if (!courierCompany) {
- return wx.showToast({
- title: "请选择快递公司",
- icon: "none",
- duration: 2000,
- })
- }
- this.setData({
- isLoading: true,
- })
- let maintainType = ""
- if (afterType == "7") {
- // 换货
- maintainType = 6
- } else if (afterType == "8") {
- // 退货
- maintainType = 5
- } else if (afterType == "9") {
- // // 补货
- maintainType = 7
- }
- const para = {
- openId: getStore("wxOpenId"),
- accountId: getStore("accountId"),
- orderNo: getStore("orderNo"),
- maintainType,
- courierNo,
- courierCompany,
- }
- // wx.navigateTo({
- // url: "plugin://issuer-plugin/exchangeResult",
- // })
- // return
- if (orderType == "1") {
- // 新办
- let params = {
- filename: Api.maintainSaleOrder.filename,
- data: para,
- }
- requestFnc(
- Api.maintainSaleOrder.url,
- params,
- (res) => {
- console.log("新办工单维护 --- 接口返回 --", res)
- this.setData({
- isLoading: false,
- })
-
- wx.showModal({
- title: "提示",
- content:
- `${afterTypeMap.get(afterType)}完成` ||
- "" + "提交成功",
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- wx.reLaunch({
- url: getStore("redirectUrl"),
- })
- }
- },
- })
- },
- (msg) => {
- this.setData({
- isLoading: false,
- })
- }
- )
- } else if (orderType == "2") {
- // 售后
- let params = {
- filename: Api.maintainAfterSaleOrder.filename,
- data: para,
- }
- requestFnc(
- Api.maintainAfterSaleOrder.url,
- params,
- (res) => {
- console.log("售后工单维护 ---接口返回 --", res)
- this.setData({
- isLoading: false,
- })
-
- wx.showModal({
- title: "提示",
- content: afterTypeMap.get(afterType) || "" + "提交成功",
- showCancel: false,
- success: (res) => {
- if (res.confirm) {
- wx.reLaunch({
- url: getStore("redirectUrl"),
- })
- }
- },
- })
- },
- (msg) => {
- this.setData({
- isLoading: false,
- })
- }
- )
- }
- },
-
- backHome() {
- const { afterType, orderStatus } = this.data
- if (
- (afterType == "7" && orderStatus == "13") ||
- (afterType == "9" && orderStatus == "14")
- ) {
- // 换补完成
- wx.navigateTo({
- url: "plugin://issuer-plugin/device-act-guidance?type=afterSale",
- })
- } else {
- wx.reLaunch({
- url: getStore("redirectUrl"),
- })
- }
- },
- })
|