diff --git a/pageProduct/add-Product/add-Product - 副本.vue b/pageProduct/add-Product/add-Product - 副本.vue
index f9ec7b6..e08499a 100644
--- a/pageProduct/add-Product/add-Product - 副本.vue
+++ b/pageProduct/add-Product/add-Product - 副本.vue
@@ -1,189 +1,845 @@
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{category.list[FormData.category]||'分类'}}
-
-
-
-
-
-
-
-
-
- {{FormData.specificationsGroup||'添加规格组'}}
-
-
-
-
-
-
-
-
-
-
- {{salesMethod.list[FormData.salesMethod]||'售卖方式'}}
-
-
-
-
-
-
- 库存
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
- 打折设置
-
-
+
+
+
+
+ 注:第一张图为商品封面图,图片尺寸为750x750
-
-
-
-
+
+
-
-
-
- 不参与会员折扣
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
- 每日销量上限
-
+
-
-
-
-
- 每单限购
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 设为推荐
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 名称
+ 操作
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+ 添加团购券分类
+
+
+
+
+
+
+
+
+
+
+
+
+ 选择规格
+ 编辑规格
+
+
+
+ {{FormData.specsInfoName}}
+ 请选择
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 套餐商品
+
+
+
+
+
+
+
+ 商品信息
+
+
+ 名称
+ 数量
+ 操作
+
+
+
+
+ {{product.name}}
+
+
+
+
+ x1
+
+
+
+
+
+
+
+
+ 添加商品
+
+
+
+
+
+
+
+
+
+
+ 删除分组
+
+
+
+
+
+
+ 添加分组
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 上架
+
+
+
+
+
+
+ 库存开关
+
+
+ 注:关闭则不计算出入库数据
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 设为推荐
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 删除该商品
+
-
-
-
+
+
+ 保存
+
+
+
-
- 删除该商品
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+ 确定
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesOrder/pay-order/components/edit-accountPoints.vue b/pagesOrder/pay-order/components/edit-accountPoints.vue
new file mode 100644
index 0000000..2d317b2
--- /dev/null
+++ b/pagesOrder/pay-order/components/edit-accountPoints.vue
@@ -0,0 +1,195 @@
+
+
+
+
+
+ *
+
+
+
+
+ 积分
+
+
+
+
+
+
+
+
+
+ 修改
+
+ 取消
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pagesOrder/pay-order/pay-order.vue b/pagesOrder/pay-order/pay-order.vue
index 67897b7..9ae21ad 100644
--- a/pagesOrder/pay-order/pay-order.vue
+++ b/pagesOrder/pay-order/pay-order.vue
@@ -1,17 +1,30 @@
-
- ¥
- {{discount.currentPrice?discount.currentPrice:order.amount}}
-
-
- ¥
- {{order.amount}}
-
-
- 修改
-
+
+
+ ¥
+
+ {{payPrice}}
+
+
+ ¥
+ {{order.amount}}
+
+
+ 修改
+
+
+
+
+ ¥
+ {{order.amount}}
+
+
+ 修改
+
+
+
@@ -26,7 +39,8 @@
-
+
减
{{item.name}}
@@ -36,17 +50,26 @@
-
+
-
-
-
- 服务员改价
-
- -¥{{to2(order.amount- discount.currentPrice)}}
+
+
+
+ 服务员改价
+
+ -¥{{to2(order.amount- discount.currentPrice)}}
+
+
+
+ 积分抵扣
+
+ -¥{{to2(accountPoints.price)}}
+
+
@@ -70,6 +93,10 @@
余额:
¥{{user.amount||'0'}}
+
@@ -78,6 +105,51 @@
+
+
+
+ 积分抵扣
+
+ (
+ {{user.accountPoints||'0'}}
+ )
+
+
+
+
+
+
+ {{accountPoints.num}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *
+ {{accountPoints.calcRes.unusableReason}}
+
+
+ *
+ 100积分等于{{to2(accountPoints.calcRes.equivalentPoints*100)}}元,
+
+ 最大抵扣积分{{accountPoints.calcRes.maxUsablePoints}}
+
+ ,
+ 最小抵扣积分0
+
+
+
确认付款
@@ -122,6 +194,8 @@
+
+
@@ -131,41 +205,108 @@
onMounted,
watch,
ref,
- onBeforeUnmount
+ onBeforeUnmount,
+ computed
} from 'vue';
import {
onLoad,
- onBackPress,onShow
+ onBackPress,
+ onShow
} from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js'
import * as Api from '@/http/yskApi/Instead.js'
import {
queryAllShopUser
} from '@/http/yskApi/shop-user.js'
- import {hasPermission} from '@/commons/utils/hasPermission.js'
+ import {
+ hasPermission
+ } from '@/commons/utils/hasPermission.js'
import * as orderApi from '@/http/yskApi/order.js'
import infoBox from '@/commons/utils/infoBox.js'
import editDiscount from '@/components/my-components/edit-discount.vue'
- function toQuan(){
+ import editAccountPoints from './components/edit-accountPoints.vue'
+
+ const refPoints=ref(null)
+ function refPointsOpen(){
+ if(!accountPoints.calcRes.usable&&accountPoints.sel){
+ return
+ }
+ refPoints.value.open()
+ }
+ const accountPoints = reactive({
+ sel: false,
+ num: 0,
+ calcRes:{
+ usable:false,
+ unusableReason:'',
+ minDeductionPoints:0,
+ maxUsablePoints:0
+ },
+ price:0
+ })
+ async function calcUsablePoints(){
+ const res=await Api.$calcUsablePoints({
+ memberId:order.memberId,
+ orderAmount:order.amount
+ })
+ accountPoints.calcRes=res
+ accountPoints.num=res.maxUsablePoints
+ return res;
+ }
+ watch(()=>accountPoints.sel,(newval)=>{
+ if(newval){
+ calcUsablePoints()
+ }
+ })
+ async function calcDeDuctionPoints(){
+ const res=await Api.$calcDeDuctionPoints({
+ memberId: order.memberId,
+ orderAmount: order.amount,
+ points: accountPoints.num
+ })
+ accountPoints.price=res
+ return res
+ }
+ watch(()=>accountPoints.num,(newval)=>{
+ if(!newval){
+ accountPoints.price=0
+ return
+ }
+ calcDeDuctionPoints()
+ })
+
+ function changeAccountPoints() {
+ if(!accountPoints.calcRes.usable){
+ return
+ }
+ accountPoints.sel = !accountPoints.sel
+ if (!accountPoints.sel) {
+ accountPoints.num = 0
+ }
+ }
+
+ function toQuan() {
console.log(order);
- if(!order.memberId){
- return infoBox.showToast('请先选择会员',0.5).then(()=>{
+ if (!order.memberId) {
+ return infoBox.showToast('请先选择会员', 0.5).then(() => {
chooseUser()
})
}
- go.to('PAGES_ORDER_QUAN',{
- orderId:order.id,
- memberId:order.memberId
+ go.to('PAGES_ORDER_QUAN', {
+ orderId: order.id,
+ memberId: order.memberId
})
}
- async function discountShow(){
- const bol=await hasPermission('yun_xu_da_zhe')
- if(bol){
- showModel('editMoney',true)
+ async function discountShow() {
+ const bol = await hasPermission('yun_xu_da_zhe')
+ if (bol) {
+ showModel('editMoney', true)
}
}
- let option = {isNowPay:false}
- let payFinish=ref(false)
+ let option = {
+ isNowPay: false
+ }
+ let payFinish = ref(false)
onBackPress(() => {
uni.$emit('orderDetail:update')
console.log('onBackPress');
@@ -202,18 +343,18 @@
list: [],
selIndex: 0
},
- quan:[]
+ quan: []
})
-
+
function chooseUser() {
go.to('PAGES_CHOOSE_USER')
}
//更新选择用户
- function setUser(par) {
+ function setUser(par) {
console.log(option);
const submitPar = {
tableId: order.tableId,
- orderId:order.id,
+ orderId: order.id,
masterId: order.masterId,
vipUserId: user.value.id ? user.value.id : '',
type: user.value.id ? 0 : 1 //0 设置 1 取消
@@ -221,29 +362,31 @@
Object.assign(submitPar, par)
return Api.$setUser(submitPar)
}
+
function watchChooseuser() {
uni.$off('choose-user')
uni.$on('choose-user', (data) => {
console.log(data);
- setUser({
- vipUserId: data.id ? data.id : '',
- type: data.id ? 0 : 1 //0 设置 1 取消
- }).then(res=>{
- user.value = data
- order.memberId=data.id
- init()
- })
+ setUser({
+ vipUserId: data.id ? data.id : '',
+ type: data.id ? 0 : 1 //0 设置 1 取消
+ }).then(res => {
+ user.value = data
+ order.memberId = data.id
+ init()
+ })
})
}
+
function watchChooseQuan() {
uni.$off('choose-quan')
uni.$on('choose-quan', (arr) => {
console.log(arr);
- pays.quan=arr
+ pays.quan = arr
})
}
-
- onShow(()=>{
+
+ onShow(() => {
watchChooseuser()
watchChooseQuan()
})
@@ -281,12 +424,22 @@
const discount = reactive({
})
-
+ const coupAllPrice=computed(()=>{
+ return pays.quan.reduce((prve,cur)=>{
+ return prve+cur.discountAmount*1
+ },0)
+ })
+ const payPrice=computed(()=>{
+ const discountPrice=discount.currentPrice?discount.currentPrice:order.amount
+ const calcPrice=discountPrice-coupAllPrice.value-accountPoints.price*(accountPoints.sel?1:0)
+ return (calcPrice<=0?0:calcPrice).toFixed(2)
+ })
function editDiscountConfirm(form) {
console.log(form);
Object.assign(discount, form)
getPayUrl()
}
+
async function getPayType() {
const payTypeList = await Api.$getPayType()
pays.payTypes.list = payTypeList
@@ -294,8 +447,8 @@
function changePayType(i, item) {
pays.payTypes.selIndex = i
- if (item.payType == 'vipPay' ) {
- chooseUser()
+ if (item.payType == 'vipPay') {
+ chooseUser()
}
}
//支付成功回调
@@ -303,7 +456,7 @@
infoBox.showToast('支付成功')
setTimeout(() => {
// uni.$emit('orderDetail:update')
- payFinish.value=true
+ payFinish.value = true
uni.$emit('get:table')
uni.$emit('update:orderDetail')
uni.navigateBack({
@@ -323,8 +476,8 @@
async function payOrder() {
const payType = pays.payTypes.list[pays.payTypes.selIndex].payType
if (payType == 'vipPay' && user.value.amount * 1 < order.amount * 1) {
- infoBox.showToast('余额不足')
- return
+ infoBox.showToast('余额不足')
+ return
}
await Api.$payOrder({
tableId: order.tableId,
@@ -385,11 +538,12 @@
const orderRes = await orderApi.tbOrderInfoDetail(order.orderId)
Object.assign(order, orderRes)
if (orderRes.memberId) {
+ calcUsablePoints()
queryAllShopUser({
id: orderRes.memberId
}).then(res => {
- if(res.content[0]){
- user.value =res.content[0]
+ if (res.content[0]) {
+ user.value = res.content[0]
}
})
}
@@ -420,14 +574,16 @@