diff --git a/commons/utils/goodsUtil.js b/commons/utils/goodsUtil.js index b0e821d..9ff70de 100644 --- a/commons/utils/goodsUtil.js +++ b/commons/utils/goodsUtil.js @@ -2,7 +2,7 @@ export function canComputedPackFee(v) { return v.pack && v.status != 'return' && v.status != 'refund' && v.status != 'refunding' } export function returnCanComputedGoodsArr(arr) { - return arr.filter(v=>canComputedPackFee(v)) + return arr.filter(v => canComputedPackFee(v)) } export function returnPackFee(arr) { return arr.reduce((prve, cur) => { @@ -10,18 +10,28 @@ export function returnPackFee(arr) { }, 0).toFixed(2) } -export function canTuicai(orderInfo,item){ - return orderInfo.status=='unpaid'&&orderInfo.useType!='dine-in-before'&& item.status!='return' +export function canTuicai(orderInfo, item) { + if (orderInfo.status == 'unpaid' && orderInfo.isPostpaid !== null && orderInfo.isPostpaid == 0) { + return false + } + return orderInfo.status == 'unpaid' && orderInfo.useType != 'dine-in-before' && item.status != 'return' } -export function canTuiKuan(orderInfo,item){ - return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding' +export function canTuiKuan(orderInfo, item) { + return orderInfo.status == 'closed' && item.status != 'return' && item.status != 'refund' && item.status != + 'refunding' } -export function isTui(item){ - return item.status=='return'||item.status=='refund'||item.status=='refunding' +export function isTuiCai(item) { + return item.status == 'return' } -export function numSum(arr){ - const sum=arr.reduce((a,b)=>{ - return a+b*100 - },0) - return (sum/100).toFixed(2) +export function isTui(item) { + return item.status == 'return' || item.status == 'refund' || item.status == 'refunding' +} +export function isGift(item) { + return !isTui(item) && item.gift +} +export function numSum(arr) { + const sum = arr.reduce((a, b) => { + return a + b * 100 + }, 0) + return (sum / 100).toFixed(2) } \ No newline at end of file diff --git a/commons/utils/safe-bottom.js b/commons/utils/safe-bottom.js index c8ed07d..9cfddc1 100644 --- a/commons/utils/safe-bottom.js +++ b/commons/utils/safe-bottom.js @@ -1,23 +1,32 @@ import { getCurrentInstance, } from 'vue'; -export function getElRect(elClass, dataVal) { - const instance = getCurrentInstance(); - return new Promise((resolve, reject) => { - const query = uni.createSelectorQuery().in(instance.proxy); +export async function getElRect(elClass, instance,option) { + instance = instance ? instance : getCurrentInstance(); + const query = uni.createSelectorQuery().in(instance.proxy); + try{ + const res= await getEle(query,elClass,option) + return res + }catch(e){ + console.log(e); + } +} +async function getEle(query,elClass,option){ + return new Promise((resolve, reject)=>{ query.select('.' + elClass).fields({ - size: true + size: true, + ...option }, res => { // 如果节点尚未生成,res值为null,循环调用执行 if (!res) { - setTimeout(() => { - getElRect(elClass); + return setTimeout(() => { + getEle(query,elClass,option); }, 10); - return; } resolve(res); }).exec(); }) + } export async function getSafeBottomHeight(className, height = 16) { diff --git a/components/my-components/edit-discount.vue b/components/my-components/edit-discount.vue index dfabe73..2e2c5ac 100644 --- a/components/my-components/edit-discount.vue +++ b/components/my-components/edit-discount.vue @@ -69,10 +69,14 @@ price: { type: [Number,String], default: 0 + }, + nowPrice:{ + type: [Number,String], + default: 0 } }) function currentPriceInput(newval){ - form.discount=(newval*100/form.price).toFixed() + form.discount=(newval*100/form.price) } function discountInput(newval){ form.currentPrice=(form.price*newval/100).toFixed(2) @@ -126,8 +130,8 @@ function open() { model.value.open() form.price=props.price - form.currentPrice=props.price form.discount=props.discount + form.currentPrice=(props.discount*props.price/100).toFixed(2) } function close() { diff --git a/components/my-components/my-date-pickerview.vue b/components/my-components/my-date-pickerview.vue index 7507b74..0ea73ad 100644 --- a/components/my-components/my-date-pickerview.vue +++ b/components/my-components/my-date-pickerview.vue @@ -389,9 +389,10 @@ const year = years[arr[0]] const month = arr[1] + 1 const day = arr[2] + 1 - const hour = ('0' + arr[3]).slice(-2) - const min = ('0' + arr[4]).slice(-2) - const sen = ('0' + arr[5]).slice(-2) + const hour = ('0' + (arr[3]||0)).slice(-2) + console.log(hour) + const min = ('0' + (arr[4]||0)).slice(-2) + const sen = ('0' + (arr[5]||0)).slice(-2) if (isObj) { return new Date(year, month, day, hour, min, sen) } @@ -400,6 +401,7 @@ function confirm(e) { + console.log(value.value); const start = returnDateString(value.value) console.log(start); const end = returnDateString(value1.value) @@ -487,7 +489,9 @@ const endTotal = returnDateString(e.detail.value, true).getTime() value1.value = e.detail.value nextTick(() => { - value1.value = endTotal < startTotal ? value.value : e.detail.value + if (props.isArea) { + value1.value = endTotal < startTotal ? value.value : e.detail.value + } debounce(changeDays(true, value1.value), 100) }) } @@ -521,7 +525,7 @@ } function nullFunction() { - + } function pickend(e) { diff --git a/http/yskApi/Instead.js b/http/yskApi/Instead.js index 3221307..d964201 100644 --- a/http/yskApi/Instead.js +++ b/http/yskApi/Instead.js @@ -331,4 +331,62 @@ export function $returnOrder(data) { ...data } }); +} + +//获取订单可用优惠券 +export function $activateByOrderId(data) { + return request({ + url: '/api/tbShopCoupon/activateByOrderId', + method: "get", + params:{ + shopId: uni.getStorageSync("shopId"), + ...data + } + }); +} + +//会员积分列表 +export function $returnMemberPointsList(data) { + return request({ + url: '/api/points/member-points/page', + method: "get", + params:{ + shopId: uni.getStorageSync("shopId"), + ...data + } + }); +} + +// 会员积分账户信息 +export function $returnMemberPoints(memberId) { + return request({ + url: '/api/points/member-points/'+memberId, + method: "get", + params:{ + shopId: uni.getStorageSync("shopId"), + ...data + } + }); +} +//002-获取订单可用积分及抵扣金额(支付页面使用) +export function $calcUsablePoints(data) { + return request({ + url: '/api/points/member-points/calc-usable-points', + method: "get", + params:{ + shopId: uni.getStorageSync("shopId"), + ...data + } + }); +} +// 003-根据积分计算可抵扣金额 +export function $calcDeDuctionPoints(data) { + return request({ + url: '/api/points/member-points/calc-deduction-amount', + method: "get", + params:{ + shopId: uni.getStorageSync("shopId"), + ...data + } + }); } \ No newline at end of file diff --git a/http/yskApi/http.js b/http/yskApi/http.js index 67aef22..9f39d97 100644 --- a/http/yskApi/http.js +++ b/http/yskApi/http.js @@ -17,13 +17,13 @@ import infoBox from "@/commons/utils/infoBox.js" import go from '@/commons/utils/go.js'; import { reject } from 'lodash'; // 测试服 -let baseUrl = 'https://admintestpapi.sxczgkj.cn' +// let baseUrl = 'https://admintestpapi.sxczgkj.cn' //预发布 // let baseUrl = 'https://pre-cashieradmin.sxczgkj.cn' //正式 -// let baseUrl = 'https://cashieradmin.sxczgkj.cn' +let baseUrl = 'https://cashieradmin.sxczgkj.cn' // 王伟本地测 // let baseUrl = '/ww' diff --git a/pageBwc/index/index.vue b/pageBwc/index/index.vue index c91d0e9..98d3c26 100644 --- a/pageBwc/index/index.vue +++ b/pageBwc/index/index.vue @@ -1,23 +1,23 @@ @@ -99,13 +131,22 @@ - - 小计¥ - {{allPrice}} + + + + 已优惠¥{{youhuiAllPrice}} + + + + + 小计¥ + {{allPrice}} + + - + + \ No newline at end of file diff --git a/pagesOrder/pay-order/pay-order.vue b/pagesOrder/pay-order/pay-order.vue index 50c53d9..3811782 100644 --- a/pagesOrder/pay-order/pay-order.vue +++ b/pagesOrder/pay-order/pay-order.vue @@ -1,43 +1,98 @@