Merge branch 'test' of e.coding.net:g-cphe0354/yinshoukeguanliduan/management into gyq

This commit is contained in:
gyq 2024-11-22 09:34:22 +08:00
commit 796fc49fb1
12 changed files with 248 additions and 62 deletions

View File

@ -3,13 +3,13 @@ ENV = 'production'
# 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇Nginx 配置
# 接口地址,注意协议,如果你没有配置 ssl需要将 https 改为 http
# 测试
VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# VUE_APP_BASE_API = 'https://admintestpapi.sxczgkj.cn'
# 生产
# VUE_APP_BASE_API = 'https://cashieradmin.sxczgkj.cn'
# 预发布接口
# VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
VUE_APP_BASE_API = 'https://pre-cashieradmin.sxczgkj.cn'
# VUE_APP_BASE_API = 'http://192.168.2.98:8000'
# 如果接口是 http 形式, wss 需要改为 ws

View File

@ -15,6 +15,17 @@ export function tbPrintMachine(data, method = "post") {
});
}
// 开票
export function getbinding(data) {
return request({
url: "/api/tbShopInfo/binding",
method: "post",
data: {
shopId: localStorage.getItem("shopId"),
...data
}
});
}
/**
* 获取应用中心列表
* @returns

View File

@ -313,6 +313,7 @@ export default {
width: 100%;
height: 100%;
display: block;
object-fit: cover;
}
.icon {
@ -376,6 +377,8 @@ export default {
.title {
font-size: 12px;
line-height: 16px;
padding: 6px 0;
}
.btm {

View File

@ -11,7 +11,7 @@
<el-radio label="vip">仅会员</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="费赠送积分" prop="consumeAmount">
<el-form-item label="费赠送积分" prop="consumeAmount">
<el-input v-model="form.consumeAmount" style="width: 250px;"
@input="inputFilterInt($event, 'consumeAmount')">
<template slot="prepend">每消费</template>

View File

@ -2,6 +2,15 @@
<div class="app-container">
<div class="title">应用中心</div>
<div class="list">
<div class="item" @click="upPop">
<img src="./kp.png" class="icon">
<div class="info">
<div class="name">开票</div>
<div class="intro">
</div>
</div>
</div>
<div class="item" v-for="item in list" :key="item.id" @click="to(item)">
<img :src="item.coverImg" class="icon">
<div class="info">
@ -12,21 +21,67 @@
</div>
</div>
</div>
<!-- 弹窗 -->
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
<el-form :model="forms">
<el-form-item label="账号:" label-width="60px">
<el-input v-model="forms.account" :disabled="title != '绑定数点票账号'" autocomplete="off"></el-input>
</el-form-item>
<!-- <el-form-item label="密码/验证码" label-width="120px">
<el-input v-model="forms.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="开票项目:" label-width="120px">
<el-input v-model="forms.name" autocomplete="off"></el-input>
</el-form-item>
<el-form-item label="开票类型:" label-width="120px">
<el-input v-model="forms.name" autocomplete="off"></el-input>
</el-form-item> -->
<div style="text-align: right;" v-if="title == '绑定数点票账号'">联系区域经理开通</div>
<div style="text-align: center;" v-else @click="title = '绑定数点票账号'">更换绑定</div>
<!-- <el-form-item label="活动区域" label-width="120px">
<el-select v-model="form.region" placeholder="请选择活动区域">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer" v-if="title == '绑定数点票账号'">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="sumbitEvent"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { appCenterGet } from "@/api/application";
import { appCenterGet, getbinding } from "@/api/application";
export default {
data() {
return {
list: []
list: [],
dialogVisible: false,
forms: {},
title: '绑定数点票账号',
}
},
mounted() {
this.appCenterGet()
this.getbinding()
},
methods: {
upPop() {
this.dialogVisible = true
},
handleClose() {
},
sumbitEvent() {
if (this.forms.account) {
this.dialogVisible = false
this.getbinding(this.forms)
}
},
//
to(item) {
localStorage.setItem('applocation', JSON.stringify(item))
@ -42,7 +97,24 @@ export default {
} catch (error) {
console.log(error);
}
},
//
async getbinding(d = "") {
try {
const res = await getbinding(d)
if (res) {
this.forms = res.store
this.title = '数电票账号已绑定'
} else {
this.title = '绑定数点票账号'
this.forms = {}
}
} catch (error) {
console.log(error);
}
}
}
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

View File

@ -173,7 +173,7 @@ export default {
async profilepicture(d) {
this.handleSpeak(d.callNum)
this.handleSpeak('请'+d.callNum+'用餐')
let res = await callTablecall({
shopId: localStorage.getItem('shopId'),
callQueueId: d.id

View File

@ -3,7 +3,7 @@
<div class="u-p-15">
<div class="u-m-t-20">
<el-form label-width="90px" label-position="left">
<el-form-item label="应付金额">
<el-form-item label="总价">
<div class="color-red u-font-18 font-600">{{ form.money }}</div>
<!-- <el-input :value="form.money" disabled> </el-input> -->
</el-form-item>

View File

@ -10,6 +10,7 @@
v-for="(item, index) in list"
:key="index"
:type="sel === item.payType ? 'primary' : ''"
:disabled="disabledPayType.includes(item.payType)"
>
{{ item.payName }}
</el-button>
@ -30,6 +31,10 @@ export default {
type: [String, Number],
default: '',
},
disabledPayType:{
type:Array,
default:()=>[]
}
},
data() {
return {
@ -38,6 +43,10 @@ export default {
};
},
watch: {
disabledPayType(){
const item = this.list.find(v=>!this.disabledPayType.includes(v.payType))
this.sel=item.payType
},
sel(newval) {
console.log(newval);
this.$emit("input", newval);

View File

@ -16,11 +16,7 @@
:data="quans.fullReductionCoupon"
@cell-click="fullReductionCouponClick"
>
<el-table-column
type="index"
label=""
v-if="quans.fullReductionCoupon.length > 0"
>
<el-table-column type="index" label="">
<template v-slot="scope">
<el-checkbox
@change="fullReductionCouponClick(scope.row)"
@ -65,10 +61,7 @@
:data="quans.productCoupon"
style="width: 100%"
>
<el-table-column
label=""
v-if="quans.fullReductionCoupon.length > 0"
>
<el-table-column>
<template v-slot="scope">
<el-checkbox
@change="productCouponClick(scope.row)"
@ -112,11 +105,11 @@
</el-table-column>
<el-table-column prop="useRestrictions" label="描述">
</el-table-column>
<el-table-column prop="useRestrictions" label="是否可用">
<!-- <el-table-column prop="useRestrictions" label="是否可用">
<template v-slot="scope">
{{ scope.row.use ? "可以" : "不可用" }}
</template>
</el-table-column>
</el-table-column> -->
</el-table>
</el-tab-pane>
</el-tabs>
@ -232,11 +225,11 @@ export default {
isVip: false,
};
},
}
},
},
data() {
return {
orderPrice:0,
orderPrice: 0,
fullReductionCouponSel: {
id: "",
},
@ -297,7 +290,7 @@ export default {
$goodsPayPriceMap[row.proId],
index,
row.num
);
).toFixed(2);
} else {
return 0;
}
@ -310,7 +303,8 @@ export default {
const index = this.quansSelArr.findIndex((item) => item.id == row.id);
if (row.type == 2 && index != -1) {
this.quansSelArr.splice(index, 1);
this.quans.productCoupon[index].checked = false;
const proIndex=this.quans.productCoupon.findIndex((v) => v.id == row.id);
this.quans.productCoupon[proIndex].checked = false;
}
if (row.type == 1 && index != -1) {
this.fullReductionCouponSel = { id: "" };
@ -350,16 +344,44 @@ export default {
if (!item.use) {
return;
}
const hasSelNum = this.quansSelArr
.filter((v) => v.type == 2 && v.proId == item.proId)
.reduce((a, b) => {
return a + b.num;
}, 0);
const maxSelNum = $goodsPayPriceMap[item.proId].length;
const coupMaxUseNum = Math.min(item.num, maxSelNum - hasSelNum);
const canUseNum = Math.min(maxSelNum, coupMaxUseNum);
if (this.fullReductionCouponSel.id && !item.checked) {
const goodsQuan = this.quans.productCoupon.filter((v) => v.checked);
const fullReductionCoupon = this.fullReductionCouponSel.id
? [this.fullReductionCouponSel]
: [];
let coupArr = [...goodsQuan, item];
let coupArr = [...goodsQuan, { ...item, num: canUseNum }];
const payPrice =
this.orderPrice -
returnCouponAllPrice(coupArr, canDikouGoodsArr, this.vipUser);
console.log(payPrice);
if (payPrice <= 0) {
return this.$confirm(
"选择该商品券后支付金额将为0继续选择将取消选择的满减券",
"提示",
{
confirmButtonText: "继续选择",
cancelButtonText: "取消",
type: "warning",
}
)
.then(() => {
this.fullReductionCouponSel = {
id: "",
};
this.quansSelArr.splice(0, 1);
})
.catch(() => {});
}
if (this.fullReductionCouponSel.fullAmount > payPrice) {
this.$confirm(
"选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券",
@ -379,13 +401,19 @@ export default {
}
}
item.checked = !item.checked;
if (!item.checked) {
console.log(index);
const index = this.quansSelArr.findIndex((v) => v.id == item.id);
this.quansSelArr.splice(index, 1);
} else {
this.quansSelArr.push({ ...item, num: canUseNum });
}
const CheckedArr = this.quans.productCoupon.filter((v) => v.checked);
this.quansSelArr = [
...(this.fullReductionCouponSel.id
? [this.fullReductionCouponSel]
: []),
...CheckedArr,
];
if (CheckedArr.length <= 0) {
return this.quans.productCoupon.map((v) => {
v.use = true;
});
}
const noCheckedArr = this.quans.productCoupon.filter((v) => !v.checked);
noCheckedArr.map((v) => {
v.use = returnCoupCanUse(canDikouGoodsArr, v, CheckedArr);
@ -405,12 +433,12 @@ export default {
},
confirm() {
this.$emit("confirm", [...this.quansSelArr]);
this.$emit("confirm", [...this.quansSelArr], $goodsPayPriceMap);
this.close();
},
async open(data, propSelCoup) {
console.log(data);
this.orderPrice=data.orderPrice;
this.orderPrice = data.orderPrice;
this.quansSelArr = [...propSelCoup];
$goodsPayPriceMap = returnGoodsPayPriceMap(this.goodsArr || []);
if (data.memberId) {
@ -419,7 +447,7 @@ export default {
memberId: data.memberId,
});
quansRes.fullReductionCoupon = quansRes.fullReductionCoupon.filter(
(v) => v.use && this.orderPrice * 1 >= v.fullAmount * 1
(v) =>this.orderPrice<=0?false:(v.use && this.orderPrice * 1 >= v.fullAmount * 1)
);
const selFullReductionCoupon = this.quansSelArr.find(
(v) => v.type == 1
@ -442,6 +470,7 @@ export default {
checked: this.quansSelArr.find((selCoup) => selCoup.id == v.id)
? true
: false,
use:this.orderPrice<=0?false:calcCoup.use
};
})
.filter((v) => v.use);

View File

@ -964,7 +964,7 @@
</el-table-column>
<el-table-column label="商品信息" width="120">
<template v-slot="scope">
<div class="u-flex">
<div class="u-flex" v-if="scope.row.type == 2">
<div class="u-flex">
<el-image
:src="scope.row.productCover"
@ -982,9 +982,14 @@
</el-table-column>
<el-table-column prop="discountAmount" label="抵扣">
<template v-slot="scope">
<span class="color-red">
<span class="color-red" v-if="scope.row.type == 1">
{{ scope.row.discountAmount }}
</span>
<span class="color-red" v-if="scope.row.type == 2">
{{
returnProDiscount(scope.row, scope.row.index)
}}
</span>
</template>
</el-table-column>
<el-table-column prop="useRestrictions" label="">
@ -1011,6 +1016,7 @@
ref="refPayType"
v-model="order.payType"
@itemClick="payTypeItemClick"
:disabledPayType="disabledPayType"
>
</pay-type>
<div style="margin-top: 20px">
@ -1094,13 +1100,7 @@
</div>
<div class="detail_form_item">
<div class="left">应付金额</div>
<div class="right redfont">
{{
currentPayMoney - points.toMoney <= 0
? 0
: (currentPayMoney - points.toMoney) | to2
}}
</div>
<div class="right redfont">{{ yinFuJinE }}</div>
</div>
<div class="line"></div>
</div>
@ -1481,6 +1481,9 @@ import {
returnVipDiscountPrice,
returnCouponAllPrice,
} from "./util.js";
import { returnProductCoupAllPrice } from "./quan_util.js";
//0n
let $goodsPayPriceMap = {};
import { $status } from "@/utils/table.js";
let $originTableList = [];
@ -1501,6 +1504,7 @@ export default {
},
data() {
return {
disabledPayType: [],
//
points: {
res: {
@ -1609,6 +1613,7 @@ export default {
total: 0,
},
order: {
status: "",
packFee: {
totalNumber: 0,
status: "",
@ -1714,8 +1719,8 @@ export default {
},
computed: {
isShowVipPrice() {
if(!this.shopInfo.isMemberPrice){
return false
if (!this.shopInfo.isMemberPrice) {
return false;
}
return this.vipUser.isVip ? true : false;
},
@ -1752,11 +1757,12 @@ export default {
const amount = this.createOrder.data.amount || 0;
const discount = this.createOrder.discount || 1;
// const total=((amount - this.coupdiscount) * this.createOrder.discount - this.points.toMoney)
const total = (amount - this.coupdiscount) * this.createOrder.discount;
const total = (amount) * this.createOrder.discount - this.coupdiscount;
return total <= 0 ? 0 : total;
},
yinFuJinE() {
const total = this.currentPayMoney - (this.points.toMoney || 0);
console.log(total)
if (this.isCreateOrder) {
return total.toFixed(2);
} else {
@ -1971,6 +1977,13 @@ export default {
},
},
watch: {
yinFuJinE: function (newval) {
if (newval <= 0) {
this.disabledPayType = ["scanCode", "deposit"];
} else {
this.disabledPayType = [];
}
},
"goods.query.categoryId": function (newval) {
this.goods.query.page = 1;
this.goods.list = [];
@ -2038,8 +2051,8 @@ export default {
// this.masterId = masterId;
console.log("this.createOrder.data");
console.log(this.createOrder.data);
if(this.createOrder.data.memberId==val){
return
if (this.order.status == "finish") {
return;
}
$setUser({
tableId: this.table.tableId,
@ -2053,6 +2066,8 @@ export default {
this.getOrderData().then(() => {
this.pointsValueChange(this.points.value);
});
} else {
this.getCart();
}
});
},
@ -2171,6 +2186,21 @@ export default {
this.open(this.$route.query);
},
methods: {
returnProDiscount(row) {
console.log(row);
//
const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
const index = arr.findIndex((v) => v.id == row.id);
if (index != -1) {
return returnProductCoupAllPrice(
$goodsPayPriceMap[row.proId],
index,
row.num
).toFixed(2);
} else {
return 0;
}
},
lingshicaiShow() {
this.$refs.refPopAddCai.open();
},
@ -2231,14 +2261,15 @@ export default {
{
id: this.createOrder.data.id,
memberId: this.createOrder.data.memberId || this.vipUser.id,
orderPrice:(this.yinFuJinE*1+this.coupdiscount*1).toFixed(2)
orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2),
},
[...this.quansSelArr]
);
},
quansConfirm(e) {
quansConfirm(e, goodsPayPriceMap) {
console.log(e);
this.quansSelArr = [...e];
$goodsPayPriceMap = goodsPayPriceMap;
},
searchInput(e) {
console.log(e);
@ -2646,7 +2677,7 @@ export default {
if (!canDiscount) {
return;
}
const amount = this.createOrder.data.amount - this.coupdiscount;
const amount = this.createOrder.data.amount;
this.refToggle("refDiscount", true, {
amount,
discount: this.createOrder.discount * 100,
@ -2834,6 +2865,7 @@ export default {
title: "支付成功",
type: "success",
});
this.order.status = "finish";
this.close();
// this.reset();
},
@ -3065,11 +3097,14 @@ export default {
}
if (key === "returnCart") {
console.log(this.order);
let selGoods=undefined
if(this.order.selPlaceNum==-10){
selGoods = {...this.order.seatFee,num:this.order.seatFee.number}
}else{
selGoods = this.order.old.list[this.order.selPlaceNum-1].info[this.order.old.selIndex];
let selGoods = undefined;
if (this.order.selPlaceNum == -10) {
selGoods = { ...this.order.seatFee, num: this.order.seatFee.number };
} else {
selGoods =
this.order.old.list[this.order.selPlaceNum - 1].info[
this.order.old.selIndex
];
}
console.log(selGoods);
this.refToggle("refReturnCart", true, selGoods);
@ -3538,6 +3573,7 @@ export default {
},
reset() {
// this.goods.list = [];
this.order.status = "";
this.loading = false;
this.table = "";
this.order.list = [];
@ -3911,7 +3947,6 @@ export default {
this.$router.replace({ path: "/tool/table_list" });
} else {
this.$router.replace({ path: "/tool/Instead/index" });
this.$router.go(0);
// this.reset();
// this.$router.replace({ path: "/tool/Instead/index" });
}

View File

@ -2,7 +2,7 @@ export function isTui(item) {
return item.status == 'return' || item.status == 'refund' || item.status == 'refunding'
}
//是否使用会员价
export function isUseMemberPrice(vipUser,goods){
export function isUseVipPrice(vipUser,goods){
return vipUser.id&&vipUser.isVip&&goods.isMember
}
@ -13,7 +13,7 @@ export function returnProductCouponPrice(coup, goodsArr, vipUser) {
return 0
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (isUseMemberPrice(vipUser,item) ? memberPrice : item.price) : 0;
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
return price * coup.num
}
@ -40,7 +40,8 @@ export function returnCoupCanUse(goodsArr = [], coup, selCoupArr = []) {
if (selCoupNumber >= findGoodsTotalNumber) {
return false
}
return findGoodsTotalNumber < (coup.num + selCoupNumber) ? false : true
console.log(selCoupNumber,findGoodsTotalNumber);
return findGoodsTotalNumber < selCoupNumber ? false : true
}
//查找购物车商品根据购物车商品数据返回商品券信息(抵扣价格以及是否满足可用需求)
export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
@ -54,12 +55,13 @@ export function returnProductCoupon(coup, goodsArr, vipUser, selCoupArr = []) {
}
}
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
const price = item ? (isUseMemberPrice(vipUser,item) ? memberPrice : item.price) : 0;
const price = item ? (isUseVipPrice(vipUser,item) ? memberPrice : item.price) : 0;
const discountAmount = (price * coup.num).toFixed(2)
console.log(discountAmount);
const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
// const canUse = !coup.use ? false : (discountAmount > 0 && returnCoupCanUse(goodsArr, coup, selCoupArr))
// const canUse=discountAmount>0
const canUse=coup.use
return {
...coup,
discountAmount: discountAmount,
@ -85,7 +87,7 @@ export function returnProductAllCoup(coupArr, goodsArr, vipUser) {
//返回商品实际支付价格
export function returnProductPayPrice(goods,vipUser){
const memberPrice = goods.memberPrice ? goods.memberPrice : goods.price;
const price = isUseMemberPrice(vipUser,goods) ? memberPrice : goods.price;
const price = isUseVipPrice(vipUser,goods) ? memberPrice : goods.price;
return price
}
//返回商品券抵扣的商品价格
@ -100,6 +102,23 @@ export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
return prve+curPrice
},0)
}
//返回商品券可抵扣的商品数量
export function returnProductCanUseNum(productPriceArr,startIndex,num){
console.log(productPriceArr);
console.log(num);
let n=0;
for(let i=0;i<num;i++){
if(productPriceArr[startIndex*1+i]){
n+=1
console.log(n);
}else{
break
}
}
return n
}
//返回同类商品券在同类商品价格数组里的开始位置
export function returnProCoupStartIndex(coupArr,index){
return coupArr.slice(0,index).reduce((prve,cur)=>{
@ -166,7 +185,9 @@ export function returnProductCouponAllPrice(coupArr, goodsArr, vipUser) {
}
const proCoupStartIndex=returnProCoupStartIndex(arr,i)
console.log(proCoupStartIndex);
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coup.num)
const coupNum=Math.min(goodsPayPriceMap[coup.proId].length,coup.num)
console.log(coupNum);
total+=returnProductCoupAllPrice(goodsPayPriceMap[coup.proId],proCoupStartIndex,coupNum)
}
}
@ -198,6 +219,12 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
return v
}
const isfullAmount = payPrice >= v.fullAmount * 1
if(payPrice<=0){
return {
...v,
use: false
}
}
return {
...v,
use: v.use && isfullAmount