Merge branch 'downey' of https://gitee.com/downeyin/yudao-mall-uniapp into develop
commit
d97cc41f42
3
.env
3
.env
|
@ -22,3 +22,6 @@ SHOPRO_STATIC_URL = https://file.sheepjs.com
|
||||||
|
|
||||||
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
|
# 是否开启直播 1 开启直播 | 0 关闭直播 (小程序官方后台未审核开通直播权限时请勿开启)
|
||||||
SHOPRO_MPLIVE_ON = 0
|
SHOPRO_MPLIVE_ON = 0
|
||||||
|
|
||||||
|
# 租户ID 默认 1
|
||||||
|
SHOPRO_TENANT_ID = 1
|
||||||
|
|
|
@ -130,6 +130,7 @@
|
||||||
import TradeConfigApi from '@/sheep/api/trade/config';
|
import TradeConfigApi from '@/sheep/api/trade/config';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
import AfterSaleApi from '@/sheep/api/trade/afterSale';
|
||||||
|
import { SubscribeTemplate } from '@/sheep/util/const';
|
||||||
|
|
||||||
const form = ref(null);
|
const form = ref(null);
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
|
@ -165,7 +166,7 @@
|
||||||
// 提交表单
|
// 提交表单
|
||||||
async function submit() {
|
async function submit() {
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
sheep.$platform.useProvider('wechat').subscribeMessage('order_aftersale_change');
|
sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.ORDER_AFTERSALE_CHANGE);
|
||||||
// #endif
|
// #endif
|
||||||
let data = {
|
let data = {
|
||||||
orderItemId: state.itemId,
|
orderItemId: state.itemId,
|
||||||
|
|
|
@ -6,14 +6,15 @@
|
||||||
<view class='list borRadius14'>
|
<view class='list borRadius14'>
|
||||||
<view class='item acea-row row-between-wrapper' style="display: flex;align-items: center;">
|
<view class='item acea-row row-between-wrapper' style="display: flex;align-items: center;">
|
||||||
<view>物流公司</view>
|
<view>物流公司</view>
|
||||||
<picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex"
|
<view v-if="state.expresses.length>0" style="flex:1">
|
||||||
:range="state.expresses" range-key="name">
|
<picker mode='selector' class='num' @change="bindPickerChange" :value="state.expressIndex"
|
||||||
<view class="picker acea-row row-between-wrapper">
|
:range="state.expresses" range-key="name">
|
||||||
<view class='reason'>{{ state.expresses[state.expressIndex].name }}</view>
|
<view class="picker acea-row row-between-wrapper" style="display: flex;justify-content: space-between;">
|
||||||
<!-- TODO 芋艿:这里样式有问题,少了 > 按钮 -->
|
<view class='reason'>{{ state.expresses[state.expressIndex].name }}</view>
|
||||||
<text class='iconfont icon-jiantou' />
|
<text class='iconfont _icon-forward' />
|
||||||
</view>
|
</view>
|
||||||
</picker>
|
</picker>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class='item textarea acea-row row-between' style="display: flex;align-items: center;">
|
<view class='item textarea acea-row row-between' style="display: flex;align-items: center;">
|
||||||
<view>物流单号</view>
|
<view>物流单号</view>
|
||||||
|
|
|
@ -272,7 +272,7 @@
|
||||||
|
|
||||||
// 复制
|
// 复制
|
||||||
const onCopy = () => {
|
const onCopy = () => {
|
||||||
sheep.$helper.copyText(state.orderInfo.sn);
|
sheep.$helper.copyText(state.orderInfo.no);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 去支付
|
// 去支付
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||||
import PayWalletApi from '@/sheep/api/pay/wallet';
|
import PayWalletApi from '@/sheep/api/pay/wallet';
|
||||||
|
import { SubscribeTemplate } from '@/sheep/util/const';
|
||||||
|
|
||||||
const userWallet = computed(() => sheep.$store('user').userWallet);
|
const userWallet = computed(() => sheep.$store('user').userWallet);
|
||||||
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
||||||
|
@ -73,20 +74,20 @@
|
||||||
|
|
||||||
// 发起支付
|
// 发起支付
|
||||||
async function onConfirm() {
|
async function onConfirm() {
|
||||||
const { code, data } = await PayWalletApi.createWalletRecharge({
|
// const { code, data } = await PayWalletApi.createWalletRecharge({
|
||||||
packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)?.id,
|
// packageId: state.packageList.find((item) => fen2yuan(item.payPrice) === state.recharge_money)?.id,
|
||||||
payPrice: state.recharge_money * 100
|
// payPrice: state.recharge_money * 100
|
||||||
});
|
// });
|
||||||
if (code !== 0) {
|
// if (code !== 0) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// #ifdef MP
|
// #ifdef MP
|
||||||
sheep.$platform.useProvider('wechat').subscribeMessage('money_change');
|
sheep.$platform.useProvider('wechat').subscribeMessage(SubscribeTemplate.MONEY_CHANGE);
|
||||||
// #endif
|
// #endif
|
||||||
sheep.$router.go('/pages/pay/index', {
|
// sheep.$router.go('/pages/pay/index', {
|
||||||
id: data.payOrderId,
|
// id: data.payOrderId,
|
||||||
orderType: 'recharge'
|
// orderType: 'recharge'
|
||||||
});
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
@ -256,4 +257,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { baseUrl, apiPath } from '@/sheep/config';
|
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
|
||||||
|
|
||||||
const FileApi = {
|
const FileApi = {
|
||||||
// 上传文件
|
// 上传文件
|
||||||
|
@ -15,8 +15,8 @@ const FileApi = {
|
||||||
name: 'file',
|
name: 'file',
|
||||||
header: {
|
header: {
|
||||||
// Accept: 'text/json',
|
// Accept: 'text/json',
|
||||||
Accept : '*/*',
|
Accept: '*/*',
|
||||||
'tenant-id' :'1',
|
'tenant-id': tenantId,
|
||||||
// Authorization: 'Bearer test247',
|
// Authorization: 'Bearer test247',
|
||||||
},
|
},
|
||||||
success: (uploadFileRes) => {
|
success: (uploadFileRes) => {
|
||||||
|
|
|
@ -4,13 +4,10 @@ export default {
|
||||||
// 微信相关
|
// 微信相关
|
||||||
wechat: {
|
wechat: {
|
||||||
// 小程序订阅消息
|
// 小程序订阅消息
|
||||||
subscribeTemplate: (params) =>
|
subscribeTemplate: () =>
|
||||||
request({
|
request({
|
||||||
url: 'third/wechat/subscribeTemplate',
|
url: '/member/social-user/get-subscribe-template',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
params: {
|
|
||||||
platform: 'miniProgram',
|
|
||||||
},
|
|
||||||
custom: {
|
custom: {
|
||||||
showError: false,
|
showError: false,
|
||||||
showLoading: false,
|
showLoading: false,
|
||||||
|
|
|
@ -11,10 +11,13 @@ console.log(`[芋道商城 ${version}] http://doc.iocoder.cn`);
|
||||||
|
|
||||||
export const apiPath = import.meta.env.SHOPRO_API_PATH;
|
export const apiPath = import.meta.env.SHOPRO_API_PATH;
|
||||||
export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;
|
export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;
|
||||||
|
export const tenantId = import.meta.env.SHOPRO_TENANT_ID;
|
||||||
export const websocketPath = import.meta.env.SHOPRO_WEBSOCKET_PATH;
|
export const websocketPath = import.meta.env.SHOPRO_WEBSOCKET_PATH;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
baseUrl,
|
baseUrl,
|
||||||
apiPath,
|
apiPath,
|
||||||
staticUrl,
|
staticUrl,
|
||||||
websocketPath
|
tenantId,
|
||||||
|
websocketPath,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import third from '@/sheep/api/migration/third'
|
import third from '@/sheep/api/migration/third';
|
||||||
import AuthUtil from '@/sheep/api/member/auth';
|
import AuthUtil from '@/sheep/api/member/auth';
|
||||||
import SocialApi from '@/sheep/api/member/social';
|
import SocialApi from '@/sheep/api/member/social';
|
||||||
import UserApi from '@/sheep/api/member/user';
|
import UserApi from '@/sheep/api/member/user';
|
||||||
|
@ -128,14 +128,14 @@ async function getInfo() {
|
||||||
const checkUpdate = async (silence = true) => {
|
const checkUpdate = async (silence = true) => {
|
||||||
if (uni.canIUse('getUpdateManager')) {
|
if (uni.canIUse('getUpdateManager')) {
|
||||||
const updateManager = uni.getUpdateManager();
|
const updateManager = uni.getUpdateManager();
|
||||||
updateManager.onCheckForUpdate(function (res) {
|
updateManager.onCheckForUpdate(function(res) {
|
||||||
// 请求完新版本信息的回调
|
// 请求完新版本信息的回调
|
||||||
if (res.hasUpdate) {
|
if (res.hasUpdate) {
|
||||||
updateManager.onUpdateReady(function () {
|
updateManager.onUpdateReady(function() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '更新提示',
|
title: '更新提示',
|
||||||
content: '新版本已经准备好,是否重启应用?',
|
content: '新版本已经准备好,是否重启应用?',
|
||||||
success: function (res) {
|
success: function(res) {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||||
updateManager.applyUpdate();
|
updateManager.applyUpdate();
|
||||||
|
@ -143,7 +143,7 @@ const checkUpdate = async (silence = true) => {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
updateManager.onUpdateFailed(function () {
|
updateManager.onUpdateFailed(function() {
|
||||||
// 新的版本下载失败
|
// 新的版本下载失败
|
||||||
// uni.showModal({
|
// uni.showModal({
|
||||||
// title: '已经有新版本了哟~',
|
// title: '已经有新版本了哟~',
|
||||||
|
@ -164,8 +164,8 @@ const checkUpdate = async (silence = true) => {
|
||||||
|
|
||||||
// 获取订阅消息模板
|
// 获取订阅消息模板
|
||||||
async function getSubscribeTemplate() {
|
async function getSubscribeTemplate() {
|
||||||
const { error, data } = await third.wechat.subscribeTemplate();
|
const { code, data } = await third.wechat.subscribeTemplate();
|
||||||
if (error === 0) {
|
if (code === 0) {
|
||||||
subscribeEventList = data;
|
subscribeEventList = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,11 +174,17 @@ async function getSubscribeTemplate() {
|
||||||
function subscribeMessage(event) {
|
function subscribeMessage(event) {
|
||||||
let tmplIds = [];
|
let tmplIds = [];
|
||||||
if (typeof event === 'string') {
|
if (typeof event === 'string') {
|
||||||
tmplIds.push(subscribeEventList[event]);
|
const temp = subscribeEventList.find(item => item.title.includes(event));
|
||||||
|
if (temp) {
|
||||||
|
tmplIds.push(temp.priTmplId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeof event === 'object') {
|
if (typeof event === 'object') {
|
||||||
event.forEach((item) => {
|
event.forEach((e) => {
|
||||||
if (typeof subscribeEventList[item] !== 'undefined') tmplIds.push(subscribeEventList[item]);
|
const temp = subscribeEventList.find(item => item.title.includes(e));
|
||||||
|
if (temp) {
|
||||||
|
tmplIds.push(temp.priTmplId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (tmplIds.length === 0) return;
|
if (tmplIds.length === 0) return;
|
||||||
|
@ -201,5 +207,5 @@ export default {
|
||||||
getInfo,
|
getInfo,
|
||||||
getOpenid,
|
getOpenid,
|
||||||
subscribeMessage,
|
subscribeMessage,
|
||||||
checkUpdate
|
checkUpdate,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Request from 'luch-request';
|
import Request from 'luch-request';
|
||||||
import { baseUrl, apiPath } from '@/sheep/config';
|
import { baseUrl, apiPath, tenantId } from '@/sheep/config';
|
||||||
import $store from '@/sheep/store';
|
import $store from '@/sheep/store';
|
||||||
import $platform from '@/sheep/platform';
|
import $platform from '@/sheep/platform';
|
||||||
import {
|
import {
|
||||||
|
@ -96,8 +96,8 @@ http.interceptors.request.use(
|
||||||
config.header['Authorization'] = token;
|
config.header['Authorization'] = token;
|
||||||
}
|
}
|
||||||
// TODO 芋艿:特殊处理
|
// TODO 芋艿:特殊处理
|
||||||
config.header['Accept'] = '*/*'
|
config.header['Accept'] = '*/*';
|
||||||
config.header['tenant-id'] = '1';
|
config.header['tenant-id'] = tenantId;
|
||||||
config.header['terminal'] = '20';
|
config.header['terminal'] = '20';
|
||||||
// config.header['Authorization'] = 'Bearer test247';
|
// config.header['Authorization'] = 'Bearer test247';
|
||||||
return config;
|
return config;
|
||||||
|
@ -299,4 +299,4 @@ const request = (config) => {
|
||||||
return http.middleware(config);
|
return http.middleware(config);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default request;
|
export default request;
|
||||||
|
|
|
@ -56,6 +56,13 @@ export const TimeStatusEnum = {
|
||||||
END: '已结束',
|
END: '已结束',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 订阅模版枚举
|
||||||
|
export const SubscribeTemplate = {
|
||||||
|
ORDER_AFTERSALE_CHANGE: "售后进度通知",
|
||||||
|
MONEY_CHANGE: "充值成功通知"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export const getTimeStatusEnum = (startTime, endTime) => {
|
export const getTimeStatusEnum = (startTime, endTime) => {
|
||||||
const now = dayjs();
|
const now = dayjs();
|
||||||
if (now.isBefore(startTime)) {
|
if (now.isBefore(startTime)) {
|
||||||
|
|
Loading…
Reference in New Issue