Files
rlz/coupon/app.js
renjianbo 17e91fcf84 refactor: redesign order flow - serve first, pay later
- Redesign order status flow: 0待接单→1已接单→2服务中→3待支付→4已完成
- Allow service start from status 1 (removed payment barrier)
- Add payment entry after service completion (status 3)
- Update Android/miniprogram UI status mappings
- Add order flow design document to docs/

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-21 00:56:17 +08:00

97 lines
2.4 KiB
JavaScript

// app.js
const config = require('./utils/config')
App({
onLaunch() {
const uid = wx.getStorageSync('uid')
const token = wx.getStorageSync('token')
if (uid) {
this.globalData.uid = uid
}
if (token) {
this.globalData.token = token
}
},
globalData: {
userInfo: null,
encryptedData: '',
iv: '',
code: '',
// url: 'https://ruilaizipj.com',
url: config.baseUrl,
domain: config.baseUrl,
domaintwo: config.baseUrl,
phone: '',
uid: '',
sessionKey: '',
version_number: '1.0.0',
},
console: function (msg) {
console.log(msg);
},
tip: function (params) {
var that = this;
var title = params.hasOwnProperty('title') ? params['title'] : '提示您';
var content = params.hasOwnProperty('content') ? params['content'] : '';
wx.showModal({
title: title,
content: content,
success: function (res) {
if (res.confirm) { //点击确定
if (params.hasOwnProperty('cb_confirm') && typeof (params.cb_confirm) == "function") {
params.cb_confirm();
}
} else { //点击否
if (params.hasOwnProperty('cb_cancel') && typeof (params.cb_cancel) == "function") {
params.cb_cancel();
}
}
}
})
},
getRequestHeader: function () {
return {
'content-type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer ' + this.getCache("token")
}
},
buildUrl: function (path, params) {
var url = this.globalData.domain + path;
var _paramUrl = "";
if (params) {
_paramUrl = Object.keys(params).map(function (k) {
return [encodeURIComponent(k), encodeURIComponent(params[k])].join("=");
}).join("&");
_paramUrl = "?" + _paramUrl;
}
return url + _paramUrl;
},
buildUrltwo: function (path, params) {
var url = this.globalData.domaintwo + path;
var _paramUrl = "";
if (params) {
_paramUrl = Object.keys(params).map(function (k) {
return [encodeURIComponent(k), encodeURIComponent(params[k])].join("=");
}).join("&");
_paramUrl = "?" + _paramUrl;
}
return url + _paramUrl;
},
getCache: function (key) {
var value = undefined;
try {
value = wx.getStorageSync(key);
} catch (e) {}
return value;
},
setCache: function (key, value) {
wx.setStorage({
key: key,
data: value
});
}
})