更换正式环境,测试修改
This commit is contained in:
@@ -116,8 +116,6 @@
|
||||
console.log(modal);
|
||||
}
|
||||
|
||||
console.log(props.data);
|
||||
|
||||
const edmits = defineEmits(['clear', 'updateNumber'])
|
||||
|
||||
// mask
|
||||
@@ -158,7 +156,6 @@
|
||||
}
|
||||
|
||||
const allPrice = computed(() => {
|
||||
console.log("购物车数据==",props.data)
|
||||
return props.data.reduce((prve, cur) => {
|
||||
let price = Math.floor((cur.lowPrice * cur.number)*100)/100
|
||||
return prve + price
|
||||
@@ -170,7 +167,6 @@
|
||||
result = props.data.reduce((prve, cur) => {
|
||||
return prve + cur.number
|
||||
}, 0)
|
||||
console.log(result)
|
||||
result = result > 0 ? result.toFixed(2) : 0
|
||||
return result >= 99 ? 99 : parseFloat(result)
|
||||
})
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
</template>
|
||||
<script setup>
|
||||
import { onLoad, onReady, onShow } from '@dcloudio/uni-app';
|
||||
import { onLoad, onReady, onShow, onUnload, onHide } from '@dcloudio/uni-app';
|
||||
import { inject, computed, reactive, ref, nextTick, watch, getCurrentInstance, onUnmounted, onBeforeUnmount } from 'vue';
|
||||
|
||||
import guigeModel from './components/guige'
|
||||
@@ -177,7 +177,6 @@
|
||||
is_gift: 0
|
||||
},
|
||||
orderId: null,
|
||||
isCars: false,
|
||||
isGoodsAdd: true,
|
||||
goodsData: null,
|
||||
})
|
||||
@@ -198,7 +197,6 @@
|
||||
const websocketUtil = inject('websocketUtil'); // 注入 WebSocket 工具类实例
|
||||
onLoad((opt) => {
|
||||
option = opt
|
||||
console.log("opt===",opt)
|
||||
Object.assign(data.table, opt)
|
||||
|
||||
uni.setNavigationBarTitle({
|
||||
@@ -220,15 +218,22 @@
|
||||
}
|
||||
})
|
||||
onShow(() => {
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
watchSocketOpen()
|
||||
data.isGoodsAdd = true;
|
||||
|
||||
nextTick(()=>{
|
||||
uni.showLoading({
|
||||
title: '购物车加载中',
|
||||
mask: true
|
||||
});
|
||||
watchChooseTable()
|
||||
watchUpdate()
|
||||
watchSocketOpen()
|
||||
data.isGoodsAdd = true;
|
||||
|
||||
init()
|
||||
onMessage()
|
||||
})
|
||||
|
||||
init()
|
||||
|
||||
|
||||
})
|
||||
onReady(() => {
|
||||
getElRect('list-tight-top').then(res => {
|
||||
@@ -237,12 +242,15 @@
|
||||
getMenuItemTop()
|
||||
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
|
||||
|
||||
onHide(() => {
|
||||
console.log("onHide")
|
||||
uni.$off('is-socket-open')
|
||||
websocketUtil.offMessage()
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
uni.$off('is-socket-open')
|
||||
websocketUtil.offMessage()
|
||||
});
|
||||
|
||||
|
||||
@@ -262,7 +270,6 @@
|
||||
setTabBar($category, $originGoods, [])
|
||||
}
|
||||
let shopInfo = await getShopInfo({id:uni.getStorageSync('shopInfo').id})
|
||||
console.log(shopInfo)
|
||||
uni.setStorageSync("shopInfo",shopInfo)
|
||||
// 获取分类数据
|
||||
let categoryRes = await categoryPage({ page: 1, size: 300 })
|
||||
@@ -298,11 +305,13 @@
|
||||
uni.$on('is-socket-open', (res) => {
|
||||
console.log("is-socket-open===",res)
|
||||
if( res){
|
||||
data.isCars = true;
|
||||
data.isGoodsAdd = true;
|
||||
initCart()
|
||||
} else {
|
||||
data.isCars = false;
|
||||
uni.showLoading({
|
||||
title: '购物车加载中',
|
||||
mask: true
|
||||
});
|
||||
data.isGoodsAdd = false;
|
||||
}
|
||||
})
|
||||
@@ -339,7 +348,6 @@
|
||||
switch (msg.operate_type) {
|
||||
case 'onboc_init':
|
||||
cars.length = 0
|
||||
data.isCars = true;
|
||||
console.log("购物车信息onboc_init===",msg)
|
||||
if( !data.table.tableCode ){
|
||||
data.table.tableCode = msg.table_code
|
||||
@@ -348,7 +356,6 @@
|
||||
console.log("商品信息===",cartArr)
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,cartArr)
|
||||
console.log("cartItem===",cartItem)
|
||||
if( cartItem.isGrounding||cartItem.is_temporary == 1 ){
|
||||
cartControls(cartItem,'add')
|
||||
} else {
|
||||
@@ -569,10 +576,8 @@
|
||||
// chooseTable()
|
||||
// })
|
||||
// }
|
||||
if( !data.isCars ){
|
||||
return uni.$utils.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
if( !data.isGoodsAdd ){ return;uni.$utils.showToast('isGoodsAdd...') }
|
||||
|
||||
if( !data.isGoodsAdd ){ return;}
|
||||
let $goods = data.tabbar[index].foods[foodsindex]
|
||||
if ($goods.type !== 'sku') {
|
||||
//单规格
|
||||
@@ -713,8 +718,6 @@
|
||||
delCart(e.goods.id)
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
// product_name
|
||||
params.product_name = e.goods.name
|
||||
params.sku_name = e.goods.sku_name
|
||||
}
|
||||
@@ -749,10 +752,6 @@
|
||||
* @param {Object} index
|
||||
*/
|
||||
function chooseGuige(foodsindex, index) {
|
||||
|
||||
if( !data.isCars ){
|
||||
return uni.$utils.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
const $goods = data.tabbar[index].foods[foodsindex]
|
||||
selGoods.value = $goods
|
||||
if ($goods.groupType == 1) {
|
||||
@@ -1110,9 +1109,6 @@
|
||||
*/
|
||||
const refweighitem = ref(null)
|
||||
const tapweigh = (foodsindex, index) => {
|
||||
if( !data.isCars ){
|
||||
return uni.$utils.showToast('购物车加载失败请刷新重试...')
|
||||
}
|
||||
const goods = data.tabbar[index].foods[foodsindex]
|
||||
refweighitem.value.open(foodsindex, index, goods)
|
||||
}
|
||||
@@ -1271,7 +1267,6 @@
|
||||
uni.$off('add:cashCai')
|
||||
uni.$on('update:createOrderIndex', () => {
|
||||
cars.length = 0
|
||||
console.log('update:createOrderIndex');
|
||||
init()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user