Phase1 后端核心:
- 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess)
- SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机)
- StoreOrderCreateServices 周期循环佣金计算
- StoreOrderTakeServices 佣金发放后同步冻结积分
- StoreProductServices/StoreProduct 保存 is_queue_goods
Phase2 后端接口:
- GET /api/hjf/brokerage/progress 佣金周期进度
- GET /api/hjf/assets/overview 资产总览
- HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务
- PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口
- GET /adminapi/hjf/points/release_log 积分日志接口
Phase3 前端清理:
- hjfCustom.js 路由精简(仅保留 points/log)
- hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口
- pages.json 公排→推荐佣金/佣金记录/佣金规则
Phase4-5 前端改造:
- queue/status.vue 推荐佣金进度页整体重写
- 商品详情/订单确认/支付结果页文案与逻辑改造
- 个人中心/资产页/引导页/规则页文案改造
- HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造
- 推广中心嵌入佣金进度摘要
- hjfMockData.js 全量更新(公排字段→佣金字段)
Phase6 Admin 增强:
- 用户列表新增 frozen_points/available_points 列及不考核操作按钮
- hjfPoints.js USE_MOCK=false 对接真实积分日志接口
Phase7 配置文档:
- docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单
Made-with: Cursor
231 lines
5.0 KiB
JavaScript
231 lines
5.0 KiB
JavaScript
// +----------------------------------------------------------------------
|
||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
// +----------------------------------------------------------------------
|
||
// | Author: CRMEB Team <admin@crmeb.com>
|
||
// +----------------------------------------------------------------------
|
||
|
||
// #ifdef H5
|
||
import {
|
||
getWechatConfig,
|
||
getShopConfig,
|
||
wechatAuthV2
|
||
} from "@/api/public";
|
||
import {
|
||
WX_AUTH,
|
||
STATE_KEY,
|
||
LOGINTYPE,
|
||
BACK_URL
|
||
} from '@/config/cache';
|
||
import {
|
||
parseQuery
|
||
} from '@/utils';
|
||
import store from '@/store';
|
||
import Cache from '@/utils/cache';
|
||
|
||
class AuthWechat {
|
||
|
||
constructor() {
|
||
this.instance = jWeixin;
|
||
//是否实例化
|
||
this.status = false;
|
||
|
||
this.initConfig = {};
|
||
|
||
}
|
||
|
||
isAndroid(){
|
||
let u = navigator.userAgent;
|
||
return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
|
||
}
|
||
|
||
signLink() {
|
||
if (typeof window.entryUrl === 'undefined' || window.entryUrl === '') {
|
||
window.entryUrl = location.href
|
||
}
|
||
return /(Android)/i.test(navigator.userAgent) ? location.href : window.entryUrl;
|
||
}
|
||
|
||
/**
|
||
* 初始化wechat(分享配置)
|
||
*/
|
||
wechat() {
|
||
return new Promise((resolve, reject) => {
|
||
// if (this.status && !this.isAndroid()) return resolve(this.instance);
|
||
getWechatConfig()
|
||
.then(res => {
|
||
this.instance.config(res.data);
|
||
this.initConfig = res.data;
|
||
this.status = true;
|
||
this.instance.ready(() => {
|
||
resolve(this.instance);
|
||
})
|
||
}).catch(err => {
|
||
this.status = false;
|
||
reject(err);
|
||
});
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 验证是否初始化
|
||
*/
|
||
verifyInstance() {
|
||
let that = this;
|
||
return new Promise((resolve, reject) => {
|
||
if (that.instance === null && !that.status) {
|
||
that.wechat().then(res => {
|
||
resolve(that.instance);
|
||
}).catch(() => {
|
||
return reject();
|
||
})
|
||
} else {
|
||
return resolve(that.instance);
|
||
}
|
||
})
|
||
}
|
||
// 微信公众号的共享地址
|
||
openAddress() {
|
||
return new Promise((resolve, reject) => {
|
||
this.wechat().then(wx => {
|
||
this.toPromise(wx.openAddress).then(res => {
|
||
resolve(res);
|
||
}).catch(err => {
|
||
reject(err);
|
||
});
|
||
}).catch(err => {
|
||
reject(err);
|
||
})
|
||
});
|
||
}
|
||
|
||
// 获取经纬度;
|
||
location(){
|
||
return new Promise((resolve, reject) => {
|
||
this.wechat().then(wx => {
|
||
this.toPromise(wx.getLocation,{type: 'wgs84'}).then(res => {
|
||
resolve(res);
|
||
}).catch(err => {
|
||
reject(err);
|
||
});
|
||
}).catch(err => {
|
||
reject(err);
|
||
})
|
||
});
|
||
}
|
||
|
||
// 使用微信内置地图查看位置接口;
|
||
seeLocation(config){
|
||
return new Promise((resolve, reject) => {
|
||
this.wechat().then(wx => {
|
||
this.toPromise(wx.openLocation, config).then(res => {
|
||
resolve(res);
|
||
}).catch(err => {
|
||
reject(err);
|
||
});
|
||
}).catch(err => {
|
||
reject(err);
|
||
})
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 微信支付
|
||
* @param {Object} config
|
||
*/
|
||
pay(config) {
|
||
return new Promise((resolve, reject) => {
|
||
this.wechat().then((wx) => {
|
||
this.toPromise(wx.chooseWXPay, config).then(res => {
|
||
resolve(res);
|
||
}).catch(res => {
|
||
reject(res);
|
||
});
|
||
}).catch(res => {
|
||
reject(res);
|
||
});
|
||
});
|
||
}
|
||
|
||
toPromise(fn, config = {}) {
|
||
return new Promise((resolve, reject) => {
|
||
fn({
|
||
...config,
|
||
success(res) {
|
||
resolve(res);
|
||
},
|
||
fail(err) {
|
||
reject(err);
|
||
},
|
||
complete(err) {
|
||
reject(err);
|
||
},
|
||
cancel(err) {
|
||
reject(err);
|
||
}
|
||
});
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 绑定事件
|
||
* @param {Object} name 事件名
|
||
* @param {Object} config 参数
|
||
*/
|
||
wechatEvevt(name, config) {
|
||
let that = this;
|
||
return new Promise((resolve, reject) => {
|
||
let configDefault = {
|
||
fail(res) {
|
||
if (that.instance) return reject({
|
||
is_ready: true,
|
||
wx: that.instance
|
||
});
|
||
that.verifyInstance().then(wx => {
|
||
return reject({
|
||
is_ready: true,
|
||
wx: wx
|
||
});
|
||
})
|
||
},
|
||
success(res) {
|
||
return resolve(res,2222);
|
||
}
|
||
};
|
||
Object.assign(configDefault, config);
|
||
that.wechat().then(wx => {
|
||
if (typeof name === 'object') {
|
||
name.forEach(item => {
|
||
wx[item] && wx[item](configDefault)
|
||
})
|
||
} else {
|
||
wx[name] && wx[name](configDefault)
|
||
}
|
||
})
|
||
});
|
||
}
|
||
|
||
|
||
isWeixin() {
|
||
return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
|
||
}
|
||
|
||
async newAuth(scope,url){
|
||
try {
|
||
let res = await getWechatConfig();
|
||
let redirect_url = encodeURIComponent(url);
|
||
let state = encodeURIComponent(("" + Math.random()).split(".")[1] + "authorizestate");
|
||
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.data.appId}&redirect_uri=${redirect_url}&response_type=code&scope=${scope}&state=${state}&connect_redirect=1#wechat_redirect`;
|
||
} catch (err) {
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
export default new AuthWechat();
|
||
// #endif
|