代码更新
This commit is contained in:
@@ -300,10 +300,10 @@
|
||||
import $storageManage from '@/commons/utils/storageManage.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import { getNowCart } from '@/pagesCreateOrder/util.js'
|
||||
import { getShopInfo } from '@/api/shop.js'
|
||||
import { getShopTableDetail } from '@/api/table.js'
|
||||
import { getProductPage } from '@/api/product.js'
|
||||
import { createOrder,getHistoryOrder } from '@/api/order.js'
|
||||
import { getShopInfo } from '@/http/api/shop.js'
|
||||
import { getShopTableDetail } from '@/http/api/table.js'
|
||||
import { getProductPage } from '@/http/api/product.js'
|
||||
import { createOrder,getHistoryOrder } from '@/http/api/order.js'
|
||||
import { number } from 'uview-plus/libs/function/test';
|
||||
|
||||
const models = new Map();
|
||||
@@ -414,7 +414,7 @@
|
||||
const $packFee = computed(() => {
|
||||
console.log("打包费===",goods.list)
|
||||
return goods.list.reduce((prve, cur) => {
|
||||
return prve + (cur.packFee*parseFloat(cur.pack_number).toFixed(0))
|
||||
return prve + ((cur.packFee||0)*parseFloat(cur.pack_number).toFixed(0))
|
||||
}, 0).toFixed(2)
|
||||
})
|
||||
|
||||
@@ -486,6 +486,7 @@
|
||||
/**
|
||||
* socket消息监听
|
||||
*/
|
||||
websocketUtil.offMessage()
|
||||
websocketUtil.onMessage(res => {
|
||||
let msg = JSON.parse(res);
|
||||
let cartItem;
|
||||
@@ -505,7 +506,11 @@
|
||||
goods.list = []
|
||||
msg.data.map(item=>{
|
||||
cartItem = getNowCart(item,$goods,pageData.user)
|
||||
cartControls(cartItem,'add')
|
||||
if( cartItem.isGrounding||cartItem.is_temporary == 1 ){
|
||||
cartControls(cartItem,'add')
|
||||
} else {
|
||||
delCart(cartItem.id)
|
||||
}
|
||||
})
|
||||
break;
|
||||
case 'onboc_add':
|
||||
@@ -515,8 +520,7 @@
|
||||
break;
|
||||
case 'onboc_edit':
|
||||
case 'edit':
|
||||
cartItem = getNowCart(msg.data,$goods,pageData.user)
|
||||
cartControls(cartItem,'edit')
|
||||
getCart()
|
||||
break;
|
||||
case 'onboc_del':
|
||||
case 'del':
|
||||
@@ -533,6 +537,23 @@
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* 删除购物车菜品
|
||||
*/
|
||||
function delCart (cartItem) {
|
||||
let params = {
|
||||
type:'onboc',
|
||||
account: uni.getStorageSync("iToken").loginId,
|
||||
shop_id: uni.getStorageSync("shopInfo").id,
|
||||
is_gift: 0,
|
||||
id: cartItem.id,
|
||||
operate_type:'del',
|
||||
table_code: cartItem.table_code,
|
||||
}
|
||||
websocketUtil.send(JSON.stringify(params))
|
||||
}
|
||||
|
||||
/**
|
||||
* socket通知购物车商品数量修改处理
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
$table,
|
||||
tableswitch
|
||||
} from '@/http/yskApi/table.js'
|
||||
import { getShopTable } from '@/api/table.js'
|
||||
import { getShopTable } from '@/http/api/table.js'
|
||||
let datas = reactive({
|
||||
current: 0,
|
||||
item: "",
|
||||
|
||||
Reference in New Issue
Block a user