Commit 65a96f88 by chenwq

优化下架逻辑,修复状态管理,更新详情页跳转参数

1 parent 44f6a776
import api from '../request/http'
module.exports = {
/**获取集团或者门店详细信息 */
getMerchantDetail(data) {
return api.post({
method: 'scrm.api.carlife.merchant.detail',
...data
})
}
}
\ No newline at end of file
......@@ -33,6 +33,7 @@ Page({
{ name: "photoEngine", label: "发动机舱" },
{ name: "photoTrunk", label: "后备箱" },
],
isOfflining: false,
showOfflineDialog: false,
offlineButtons: [
{ text: "取消", extClass: "btn_cancel", eventFn: "dialogCancel" },
......@@ -43,7 +44,6 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.isOfflining = false;
wx.setNavigationBarTitle({
title: "查看详情",
});
......@@ -239,19 +239,19 @@ Page({
},
onOfflineConfirm() {
if (this.isOfflining) return;
this.isOfflining = true;
if (this.data.isOfflining) return;
this.setData({ isOfflining: true });
wx.p.wxApi.showLoading("操作中...");
homeApi
.offShelfAuction({ id: this.data.orderId })
.then(() => {
this.setData({ showOfflineDialog: false });
wx.hideLoading();
wx.showToast({ title: "下架成功", icon: "success" });
this.getDetail(); // 刷新详情
wx.showToast({ title: "下架成功", icon: "success", mask: true });
setTimeout(() => {
this.isOfflining = false;
}, 600);
wx.hideLoading();
this.getDetail(); // 刷新详情
this.setData({ isOfflining: false });
}, 800);
})
.catch(() => {
this.isOfflining = false;
......
......@@ -43,7 +43,6 @@ Page({
],
},
onLoad(options) {
this.isOfflining = false;
// let { height, padding_bottom } = wx.p.store.get("navBarSystem");
// this.setData({ navHeight: height });
},
......@@ -154,24 +153,23 @@ Page({
this.setData({ showOfflineDialog: true, offlineTargetId: id });
},
onOfflineConfirm() {
if (this.isOfflining) return;
this.isOfflining = true;
if (this.data.isOfflining) return;
this.setData({ isOfflining: true });
wx.p.wxApi.showLoading("操作中...");
homeApi
.offShelfAuction({ id: this.data.offlineTargetId })
.then(() => {
// 这里执行具体的下架逻辑
this.setData({ showOfflineDialog: false });
wx.showToast({ title: "操作成功", icon: "success" });
wx.hideLoading();
this.onRefresh();
this.setData({ offlineTargetId: null });
wx.showToast({ title: "下架成功", icon: "success", mask: true });
setTimeout(() => {
this.isOfflining = false;
}, 600);
wx.hideLoading();
this.onRefresh();
this.setData({ offlineTargetId: null, isOfflining: false });
}, 800);
})
.catch(() => {
this.isOfflining = false;
this.setData({ isOfflining: false });
wx.hideLoading();
});
},
......
......@@ -89,22 +89,20 @@ Page({
onLogoutConfirm() {
if (this.data.isLogouting) return;
this.setData({ isLogouting: true });
this.toggleLogoutDialog();
wx.p.wxApi.showLoading("加载中...");
commonApi
.logout()
.then(() => {
this.setData({ isLogouting: false });
this.setData({ showLogoutDialog: false });
wx.p.wxApi.showLoading();
wx.p.storage.rm("token");
wx.p.isLogin = false;
wx.p.storage.rm("userInfo");
wx.hideLoading();
wx.p.router.redirectTo("/pages/Login/Login");
})
.catch(() => {
this.setData({ isLogouting: false });
wx.hideLoading();
});
})
},
async goToInspection() {
......
......@@ -18,7 +18,7 @@
{
"name": "详情",
"pathName": "packageIndex/pages/orderDetail/orderDetail",
"query": "id=56",
"query": "id=59",
"launchMode": "default",
"scene": null
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!