Merge branch 'prod' of https://newgitea.sxczgkj.cn/czg_team/cashier_wx into test
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
export default async (params) => {
|
||||
let url = params.url;
|
||||
let method = params.method || "get";
|
||||
@@ -9,7 +8,31 @@ export default async (params) => {
|
||||
const shopId = uni.cache.get("shopId") * 1;
|
||||
const userInfo = uni.cache.get("userInfo") || {};
|
||||
// #ifdef H5
|
||||
token = "b61c8b0f1c9d47ad924e33c48b496ce6";
|
||||
token = "1b5e8baf0cc1492a858a208f113d0971";
|
||||
uni.cache.set('userInfo', {
|
||||
"acQrcodeValidTime": "2026-01-13 13:35:59",
|
||||
"alipayOpenId": "",
|
||||
"birthDay": "",
|
||||
"createTime": "2024-03-13 10:56:40",
|
||||
"distributionAmount": 0,
|
||||
"headImg": "https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132",
|
||||
"id": "36689",
|
||||
"idCard": "",
|
||||
"isAc": 0,
|
||||
"lastLoginTime": "2025-12-24 11:24:12",
|
||||
"nickName": "微信用户",
|
||||
"password": "",
|
||||
"payPwd": "e10adc3949ba59abbe56e057f20f883e",
|
||||
"phone": "",
|
||||
"realName": "",
|
||||
"sex": null,
|
||||
"status": 1,
|
||||
"updateTime": "2025-12-24 11:22:47",
|
||||
"usePayPwd": 0,
|
||||
"wechatAcOpenId": "",
|
||||
"wechatAcQrcode": "http://weixin.qq.com/q/029s5JtP1xfmJ1g_HDxFco",
|
||||
"wechatOpenId": "or1l86yipGvwyfPhrKIAcQuSfAV8"
|
||||
})
|
||||
// #endif
|
||||
let header = {
|
||||
version: uni.conf.version,
|
||||
@@ -37,7 +60,7 @@ export default async (params) => {
|
||||
mask: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const timeoutDuration = params.timeout || 10000; // 可以通过 params 传入超时时间,默认 10 秒
|
||||
uni.request({
|
||||
|
||||
@@ -1,29 +1,38 @@
|
||||
// const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||
const debug = true; // false线上 true本地
|
||||
// #ifdef H5
|
||||
const proxyApi = "/api";
|
||||
// #endif
|
||||
const debug = false; // false线上 true本地
|
||||
let baseUrl = ''
|
||||
let baseUrlwws = ''
|
||||
|
||||
// #ifdef MP-WEIXIN || APP || MP-ALIPAY
|
||||
const proxyApi = "http://192.168.1.42"; // 调试地址
|
||||
const proxyApiwws = "ws://192.168.1.42:2348"; // 调试地址
|
||||
// #endif
|
||||
|
||||
// #ifdef H5
|
||||
const baseUrl = debug ? proxyApi : "http://192.168.1.42";
|
||||
const baseUrlwws = "ws://192.168.1.42:2348";
|
||||
// #endif
|
||||
|
||||
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
|
||||
const baseUrl = debug ? proxyApi : "https://cashier.sxczgkj.com"; // 线上
|
||||
const baseUrlwws = debug ? proxyApiwws : "wss://czgeatws.sxczgkj.com/wss"; // 线上
|
||||
// #endif
|
||||
|
||||
const version = "100";
|
||||
const autoRemoveCache = {
|
||||
count: 100000,
|
||||
size: 100000,
|
||||
};
|
||||
|
||||
function init(){
|
||||
if (debug) {
|
||||
baseUrl = 'http://192.168.1.42'
|
||||
baseUrlwws = "ws://192.168.1.42:2348";
|
||||
} else {
|
||||
baseUrl = 'https://cashier.sxczgkj.com'
|
||||
baseUrlwws = "wss://czgeatws.sxczgkj.com/wss";
|
||||
}
|
||||
// #ifdef H5
|
||||
|
||||
if (debug) {
|
||||
baseUrl = "/api";
|
||||
baseUrlwws = "http://192.168.1.42:2348";
|
||||
} else {
|
||||
baseUrl = "/prodApi";
|
||||
baseUrlwws = "https://czgeatws.sxczgkj.com/wss";
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
uni.conf = {
|
||||
debug,
|
||||
baseUrl,
|
||||
@@ -36,10 +45,10 @@ uni.conf = {
|
||||
export const changeEnv = (env) => {
|
||||
if (env === "test") {
|
||||
let baseUrl = "http://192.168.1.42"
|
||||
let baseUrlwws="ws://192.168.1.42:2348"
|
||||
let baseUrlwws = "ws://192.168.1.42:2348"
|
||||
// #ifdef H5
|
||||
baseUrl = "/api"
|
||||
baseUrlwws="http://192.168.1.42:2348"
|
||||
baseUrlwws = "http://192.168.1.42:2348"
|
||||
// #endif
|
||||
uni.conf = {
|
||||
debug: true,
|
||||
@@ -52,9 +61,13 @@ export const changeEnv = (env) => {
|
||||
};
|
||||
}
|
||||
if (env === "prod") {
|
||||
let baseUrl = "https://cashier.sxczgkj.com"
|
||||
// #ifdef H5
|
||||
baseUrl = "/prodApi"
|
||||
// #endif
|
||||
uni.conf = {
|
||||
debug: false,
|
||||
baseUrl: "https://cashier.sxczgkj.com",
|
||||
baseUrl,
|
||||
version: 100,
|
||||
autoRemoveCache,
|
||||
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
|
||||
|
||||
@@ -34,7 +34,6 @@ const showCoupon = ref(false);
|
||||
const showOfficialAccount = ref(false);
|
||||
|
||||
function modelClose(e, type) {
|
||||
console.log("modelClose", type);
|
||||
if (type == "birthdayGift") {
|
||||
showCoupon.value = true;
|
||||
return;
|
||||
|
||||
@@ -33,7 +33,6 @@ watch(showDrainage, (newVal, oldVal) => {
|
||||
const showOfficialAccount = ref(false);
|
||||
|
||||
function modelClose(e, type) {
|
||||
console.log('modelClose', type);
|
||||
if (type == 'drainage') {
|
||||
showOfficialAccount.value = true;
|
||||
return;
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
export default {
|
||||
props: {
|
||||
imgs: {
|
||||
type: [],
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
visable: {
|
||||
|
||||
@@ -475,6 +475,9 @@
|
||||
}
|
||||
|
||||
const showDiscount = computed(() => {
|
||||
if(!props.listinfo.id||props.listinfo.status!='done'){
|
||||
return false
|
||||
}
|
||||
const keys = ['productCouponDiscountAmount', 'otherCouponDiscountAmount',
|
||||
'pointsDiscountAmount', 'discountActAmount', 'newCustomerDiscountAmount', 'vipDiscountAmount'
|
||||
]
|
||||
@@ -715,9 +718,15 @@
|
||||
const newUserDiscount = ref(0);
|
||||
const back_favorablelist = toRaw(favorablelist.value);
|
||||
async function getConsumeDiscount() {
|
||||
const consumeDiscountRes = await consumeDiscount({
|
||||
shopId: uni.cache.get("shopId"),
|
||||
});
|
||||
let consumeDiscountRes =null
|
||||
if(cartStore.consumeDiscount&&cartStore.newUserDiscount){
|
||||
consumeDiscountRes=cartStore.consumeDiscount
|
||||
}else{
|
||||
consumeDiscountRes = await consumeDiscount({
|
||||
shopId: uni.cache.get("shopId"),
|
||||
});
|
||||
}
|
||||
|
||||
if (!consumeDiscountRes) {
|
||||
favorablelist.value = back_favorablelist.filter(
|
||||
(v) => v.name != "新客立减"
|
||||
|
||||
@@ -1032,7 +1032,17 @@
|
||||
// 跳转到加菜页面
|
||||
function toJiacai() {
|
||||
console.log("跳转到加菜页面");
|
||||
back();
|
||||
const arr= getCurrentPages()
|
||||
console.log(arr);
|
||||
if(arr[arr.length-1]&&arr[arr.length-1].route=='pages/product/index'){
|
||||
back();
|
||||
}else{
|
||||
uni.cache.set('tableCode',listinfo.tableCode)
|
||||
uni.cache.set('shopId',listinfo.shopId)
|
||||
uni.redirectTo({
|
||||
url:'/pages/product/index?noJump=1'
|
||||
})
|
||||
}
|
||||
}
|
||||
const packfee = computed(() => {
|
||||
return cartStore.orderCostSummary.packFee;
|
||||
@@ -1068,6 +1078,8 @@
|
||||
//支付成功后的处理
|
||||
async function paySucessCallback() {
|
||||
console.log("paySucessCallback");
|
||||
uni.$emit('updateProductIndex')
|
||||
cartStore.clearDiscount()
|
||||
orderorderInfo(true);
|
||||
cartsSocket.closeSocket();
|
||||
showDrainage.value = true;
|
||||
|
||||
@@ -124,7 +124,6 @@ onMounted(() => {
|
||||
};
|
||||
})
|
||||
.filter((v) => v.goods);
|
||||
console.log('list.value ', list.value )
|
||||
startWatch();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -195,14 +195,7 @@
|
||||
);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.cartList,
|
||||
(newCartList) => {
|
||||
console.log("购物车数据变化", newCartList);
|
||||
}, {
|
||||
deep: true,
|
||||
}
|
||||
);
|
||||
|
||||
const shopInfo = ref(uni.cache.get("shopInfo"));
|
||||
const shopUserInfo = ref(uni.cache.get("shopUserInfo"));
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<view class="paneltow">距离您{{ juli }}km</view>
|
||||
<!-- <up-icon name="arrow-right" color="#999999" size="14"></up-icon> -->
|
||||
</view>
|
||||
<view class="new-user-discount u-font-28" v-if="newUserDiscount">
|
||||
<view class="new-user-discount u-font-28" v-if="newUserDiscount&&newUserDiscount.amount">
|
||||
<text class="">新客立减¥</text>
|
||||
<text class="u-font-32">{{ newUserDiscount.amount }}</text>
|
||||
<!-- <text class="u-m-l-60">新客可随机减免金额</text> -->
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
|
||||
<view class="relative">
|
||||
<image @click.stop="getImgs(item)" class="panelfiveitemimage" :src="item.coverImg"
|
||||
<image @click.stop="getProductImgs(item)" class="panelfiveitemimage" :src="item.coverImg"
|
||||
mode="aspectFill"></image>
|
||||
<view class="limitDiscount" v-if="showLimitDiscount(item)">
|
||||
限时折扣{{ limitDiscountCountdown }}</view>
|
||||
@@ -197,8 +197,8 @@
|
||||
<view class="goods" @click="clickspecifications(item1, index, index1)"
|
||||
v-for="(item1, index1) in item.productList" :key="item1.id">
|
||||
<view class="relative">
|
||||
<image class="goodsImg" @click.stop="getImgs(item1)" v-if="item1.coverImg != null"
|
||||
:lazy-load="true" @load="imageLoaded(item1, index, index1)"
|
||||
<image class="goodsImg" @click.stop="getProductImgs(item1)" v-if="item1.coverImg != null"
|
||||
:lazy-load="true"
|
||||
:src="`${item1.coverImg}${!item1.imgLoad ? '?x-oss-process=image/resize,m_lfit,w_150,h_150' : ''}`"
|
||||
mode="aspectFill"></image>
|
||||
<image class="goodsImg"
|
||||
@@ -537,7 +537,7 @@
|
||||
<ModalList></ModalList>
|
||||
<recommendGoodsModal v-if="isDataLoaded" @onBuyClick="onBuyClick"></recommendGoodsModal>
|
||||
<goodsModal></goodsModal>
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="showPrveImg = $event">
|
||||
<xbSwiperPreview :visable="showPrveImg" :imgs="prveImgsList" @update:visable="updateShowPrveImg">
|
||||
</xbSwiperPreview>
|
||||
<!-- 显示选择人数popup -->
|
||||
<u-popup mode="bottom" :safe-area-inset-bottom="false" :show="showTableInfoPeopleNumPopup">
|
||||
@@ -810,10 +810,7 @@
|
||||
productInfo: []
|
||||
});
|
||||
|
||||
// * 图片加载
|
||||
const imageLoaded = (item, index, index1) => {
|
||||
// shopProductList.productInfo[index].products[index1]['imgLoad'] = true;
|
||||
};
|
||||
|
||||
|
||||
// 计算左侧位置
|
||||
const leftIndex = ref(0);
|
||||
@@ -1272,6 +1269,10 @@
|
||||
//预览图
|
||||
const showPrveImg = ref(false);
|
||||
const prveImgsList = ref([]);
|
||||
|
||||
function updateShowPrveImg(e){
|
||||
showPrveImg.value=e
|
||||
}
|
||||
|
||||
function prveImgs(images) {
|
||||
prveImgsList.value = images;
|
||||
@@ -1283,14 +1284,15 @@
|
||||
});
|
||||
}
|
||||
|
||||
async function getImgs(item) {
|
||||
async function getProductImgs(item) {
|
||||
console.log('getProductImgs',item)
|
||||
let res = await APIminiAppinfo(item.id);
|
||||
prveImgs(res.images);
|
||||
}
|
||||
|
||||
//获取多规格数据
|
||||
const clickspecifications = async (item, index, indexs, type) => {
|
||||
console.log(item);
|
||||
console.log('clickspecifications',item);
|
||||
// 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
||||
// if (
|
||||
// item.isSoldStock == 1 ||
|
||||
@@ -1584,9 +1586,10 @@
|
||||
|
||||
function cartInit(arr) {
|
||||
const result = []
|
||||
console.log('cartInit arr',arr);
|
||||
console.log('cartInitArr',arr);
|
||||
console.log('allGoodsArr',allGoodsArr);
|
||||
cartStore.carts = arr.map(v => {
|
||||
const goods = matchedProducts.value.find(g => g.id == v.product_id)
|
||||
const goods = allGoodsArr.find(g => g.id == v.product_id)
|
||||
const goodsSkuList = goods?goods.skuList : []
|
||||
const findSku = goodsSkuList.find(sku => sku.id == v.sku_id)
|
||||
const memberPrice = findSku ? findSku.memberPrice : 0
|
||||
@@ -1614,8 +1617,6 @@
|
||||
|
||||
for (let cart of arr) {
|
||||
const findItem = cartStore.carts.find(v => v.id == cart.id)
|
||||
console.log('findItem', findItem)
|
||||
console.log('matchedProducts', matchedProducts.value)
|
||||
if (findItem && findItem.is_time_discount != cart.is_time_discount) {
|
||||
result.push({
|
||||
id: cart.id,
|
||||
@@ -1656,7 +1657,6 @@
|
||||
// 初始化
|
||||
if (Message.operate_type == 'init') {
|
||||
// cartStore.limitTimeDiscount = Message.time_dis_info;
|
||||
console.log('onMessage:限时折扣', cartStore.limitTimeDiscount)
|
||||
cartInit(Message.data)
|
||||
|
||||
uni.hideLoading();
|
||||
@@ -1950,7 +1950,6 @@
|
||||
shopUserInfo: shopUserInfo.value,
|
||||
idKey: 'id'
|
||||
});
|
||||
console.log('限时折扣', price)
|
||||
return total + parseFloat(price) * parseFloat(item.cartNumber);
|
||||
}
|
||||
// 是否启用会员价 0否1是
|
||||
@@ -1973,8 +1972,8 @@
|
||||
const allDiscountMoney = computed(() => {
|
||||
let discountMoney = 0;
|
||||
// 新客立减
|
||||
if (newUserDiscount.value && newUserDiscount.value.discountAmount) {
|
||||
discountMoney += newUserDiscount.value.discountAmount;
|
||||
if (newUserDiscount.value && newUserDiscount.value.amount) {
|
||||
discountMoney += newUserDiscount.value.amount;
|
||||
}
|
||||
// 满减活动
|
||||
if (fullAmountActivty.value && fullAmountActivty.value.discountAmount) {
|
||||
@@ -2085,10 +2084,11 @@
|
||||
}
|
||||
return currentTime >= startTime && currentTime <= endTime;
|
||||
});
|
||||
|
||||
let allGoodsArr=[]
|
||||
// 列表请求
|
||||
const productqueryProduct = async () => {
|
||||
cartStore.goodsIsloading = false;
|
||||
allGoodsArr=[]
|
||||
try {
|
||||
shopProductList.hots = await productminiApphotsquery();
|
||||
shopProductList.productInfo = await APIgroupquery();
|
||||
@@ -2101,7 +2101,6 @@
|
||||
uni.pro.switchTab('index/index');
|
||||
}, 1000);
|
||||
}
|
||||
let allGoodsArr=[]
|
||||
if (shopProductList.productInfo.length > 0 || shopProductList.hots.length > 0) {
|
||||
//TODO handle the exception
|
||||
//第一步:将所有商品的 cartNumber 初始化为 0
|
||||
@@ -2382,7 +2381,7 @@
|
||||
tableCode: uni.cache.get('tableCode')
|
||||
});
|
||||
oldOrder.value = res;
|
||||
if (res && res.id && shopInfo.registerType == 'after') {
|
||||
if (res && res.id && shopInfo.registerType == 'after'&&!e.noJump) {
|
||||
toHistory();
|
||||
return;
|
||||
}
|
||||
@@ -2442,10 +2441,18 @@
|
||||
idKey: 'id'
|
||||
});
|
||||
}
|
||||
|
||||
function watchEmit(){
|
||||
uni.$off('updateProductIndex')
|
||||
uni.$on('updateProductIndex', function(data) {
|
||||
getNewUserDiscount()
|
||||
})
|
||||
}
|
||||
|
||||
onShow(async () => {
|
||||
isAutoClose = true;
|
||||
// 监听页面显示和隐藏
|
||||
watchEmit()
|
||||
useSocket.setOnMessage(onMessage);
|
||||
useSocket.onShowconnect();
|
||||
let res = await APIhistoryOrder({
|
||||
@@ -2489,6 +2496,12 @@
|
||||
});
|
||||
if (res && typeof res == 'object') {
|
||||
newUserDiscount.value = res;
|
||||
cartStore.consumeDiscount=res
|
||||
cartStore.newUserDiscount=res.amount
|
||||
}else{
|
||||
newUserDiscount.value = null;
|
||||
cartStore.consumeDiscount={}
|
||||
cartStore.newUserDiscount=0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,6 @@ export const useWebSocket = defineStore('socketTask', () => {
|
||||
|
||||
// 发送消息
|
||||
const sendMessage = (data) => {
|
||||
console.log('data',data)
|
||||
if(!data){
|
||||
return
|
||||
}
|
||||
|
||||
@@ -97,7 +97,6 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
.flat()
|
||||
.map(convertToBaseCartItem);
|
||||
|
||||
console.log('oldOrder.value', oldOrder.value)
|
||||
if (!oldOrder.value.id) {
|
||||
|
||||
}
|
||||
@@ -469,7 +468,6 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
});
|
||||
|
||||
function setOldOrder(data) {
|
||||
console.log("setOldOrder", data);
|
||||
oldOrder.value = data;
|
||||
allGoods.value = getAllGoodsList();
|
||||
}
|
||||
@@ -695,8 +693,18 @@ export const useCartsStore = defineStore("cart", () => {
|
||||
originAmount: 0,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// 重置优惠
|
||||
function clearDiscount(){
|
||||
newUserDiscount.value=0;
|
||||
consumeDiscount.value={}
|
||||
fullReductionActivities.value = [];
|
||||
isFreeDine.value = false;
|
||||
userPoints.value = 0;
|
||||
}
|
||||
|
||||
return {
|
||||
clearDiscount,
|
||||
getTotalPackFee,
|
||||
getTotalSeatcharge,
|
||||
getTotalTotalPrices,
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
id: getUUid(),
|
||||
})
|
||||
onMounted(()=>{
|
||||
console.log('w-qrcode:mounted')
|
||||
SpecialTreatment(opt);
|
||||
nextTick(()=>{
|
||||
generateCode(opt)
|
||||
|
||||
@@ -39,6 +39,11 @@ module.exports = defineConfig({
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/api/, '')
|
||||
},
|
||||
'/prodApi': {
|
||||
target: 'https://cashier.sxczgkj.com', // 目标服务器地址
|
||||
changeOrigin: true, // 是否更改请求源
|
||||
rewrite: path => path.replace(/^\/prodApi/, '')
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user