Merge branch 'test' of https://e.coding.net/g-cphe0354/yinshoukeguanliduan/management into gh
This commit is contained in:
commit
41fa2e0c22
|
|
@ -18,7 +18,7 @@ export function tbPrintMachine(data, method = "post") {
|
|||
// 开票
|
||||
export function getbinding(data) {
|
||||
return request({
|
||||
url: "/api/tbShopInfo/binding",
|
||||
url: "/api/invoice/binding",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
|
|
@ -26,6 +26,53 @@ export function getbinding(data) {
|
|||
}
|
||||
});
|
||||
}
|
||||
// 提交开票
|
||||
export function getsubInvoicing(data) {
|
||||
return request({
|
||||
url: "/api/invoice/subInvoicing",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 获取数电发票类型
|
||||
export function getdigitalInvoice(data) {
|
||||
return request({
|
||||
url: "/api/invoice/digitalInvoice",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 获取项目分类
|
||||
export function getindustry(data) {
|
||||
return request({
|
||||
url: "/api/invoice/industry",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
// 计算税额
|
||||
export function getstoreSe(data) {
|
||||
return request({
|
||||
url: "/api/invoice/storeSe",
|
||||
method: "post",
|
||||
data: {
|
||||
shopId: localStorage.getItem("shopId"),
|
||||
is_tax:1,
|
||||
...data
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 获取应用中心列表
|
||||
* @returns
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@
|
|||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click">
|
||||
<div class="avatar-wrapper">
|
||||
<img :src="logo || Avatar" class="sidebar-logo">
|
||||
<span class="shop_name">{{ shopName }}</span>
|
||||
<span class="shop_name">{{ shopName.length>8?shopName.substring(0,7)+'...' :shopName.substring(0,7) }}</span>
|
||||
<i class="el-icon-arrow-down icon"></i>
|
||||
</div>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
|
||||
<!-- <span style="display:block;" @click="show = true">
|
||||
<el-dropdown-item>
|
||||
布局设置
|
||||
|
|
|
|||
|
|
@ -2,15 +2,6 @@
|
|||
<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">
|
||||
|
|
@ -22,28 +13,35 @@
|
|||
</div>
|
||||
</div>
|
||||
<!-- 弹窗 -->
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%" >
|
||||
<el-dialog :title="title" :visible.sync="dialogVisible" width="30%">
|
||||
<el-form :model="forms">
|
||||
<el-form-item label="账号:" label-width="60px">
|
||||
<el-form-item label="账号:" label-width="100px">
|
||||
<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-form-item label="项目分类:" label-width="100px">
|
||||
<el-select v-model="forms.article" :disabled="title != '绑定数点票账号'" :filter-method="getindustry"
|
||||
filterable style="width: 100%;" placeholder="餐饮">
|
||||
<el-option :label="item.name" :value="item.name" v-for="(item, index) in getindustryList"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-form-item>
|
||||
<el-form-item label="数电发票:" label-width="100px">
|
||||
<el-select v-model="forms.sdType" :disabled="title != '绑定数点票账号'"
|
||||
style="width: 100%;" placeholder="">
|
||||
<el-option :label="item" :value="item" v-for="(item, index) in digitalInvoiceList[0]"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="税率:" label-width="100px">
|
||||
<el-select :disabled="title != '绑定数点票账号'" v-model="forms.taxAmount" style="width: 100%;"
|
||||
placeholder="">
|
||||
<el-option :label="item" :value="item" v-for="(item, index) in digitalInvoiceList[1]"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<div style="text-align: right;" v-if="title == '绑定数点票账号'">联系区域经理开通</div>
|
||||
<div style="text-align: center;cursor: pointer;" v-else @click="title = '绑定数点票账号'">更换绑定</div>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer" v-if="title == '绑定数点票账号'">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
|
|
@ -54,20 +52,26 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { appCenterGet, getbinding } from "@/api/application";
|
||||
import { appCenterGet, getbinding, getindustry, getdigitalInvoice } from "@/api/application";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [],
|
||||
dialogVisible: false,
|
||||
forms: {},
|
||||
forms: {
|
||||
article: '餐饮',
|
||||
sdType: ""
|
||||
},
|
||||
title: '绑定数点票账号',
|
||||
|
||||
digitalInvoiceList: [],
|
||||
getindustryList: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.appCenterGet()
|
||||
this.getbinding()
|
||||
this.getdigitalInvoice()
|
||||
this.getindustry()
|
||||
},
|
||||
methods: {
|
||||
upPop() {
|
||||
|
|
@ -75,16 +79,30 @@ export default {
|
|||
},
|
||||
sumbitEvent() {
|
||||
if (this.forms.account) {
|
||||
this.dialogVisible = false
|
||||
this.getbinding(this.forms)
|
||||
}
|
||||
},
|
||||
// 获取数电发票类型
|
||||
async getdigitalInvoice() {
|
||||
const res = await getdigitalInvoice()
|
||||
this.digitalInvoiceList = res
|
||||
},
|
||||
// 获取项目分类
|
||||
async getindustry(d = '餐饮') {
|
||||
const res = await getindustry({ article: d })
|
||||
this.getindustryList = res.list
|
||||
},
|
||||
// 跳转
|
||||
to(item) {
|
||||
localStorage.setItem('applocation', JSON.stringify(item))
|
||||
this.$router.push({
|
||||
name: item.absUrl
|
||||
})
|
||||
if (item.absUrl) {
|
||||
|
||||
this.$router.push({
|
||||
name: item.absUrl
|
||||
})
|
||||
} else {
|
||||
this.upPop()
|
||||
}
|
||||
},
|
||||
// 获取应用列表
|
||||
async appCenterGet() {
|
||||
|
|
@ -102,7 +120,11 @@ export default {
|
|||
const res = await getbinding(d)
|
||||
if (res) {
|
||||
this.forms = res.store
|
||||
this.$set(this.forms, 'article', res.article)
|
||||
this.$set(this.forms, 'sdType', res.sdType)
|
||||
this.$set(this.forms, 'taxAmount', res.taxAmount)
|
||||
this.title = '数电票账号已绑定'
|
||||
this.dialogVisible = false
|
||||
} else {
|
||||
this.title = '绑定数点票账号'
|
||||
this.forms = {}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
<template>
|
||||
<el-dialog title="开票" :visible.sync="dialogFormVisible">
|
||||
<el-form :model="forms">
|
||||
<el-form-item label="项目分类:" :label-width="labelWidth">
|
||||
<el-select v-model="forms.article" :filter-method="getindustry" filterable style="width: 100%;"
|
||||
placeholder="餐饮">
|
||||
<el-option :label="item.name" :value="item.name" v-for="(item, index) in getindustryList"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="数电发票:" :label-width="labelWidth">
|
||||
<el-select v-model="forms.type" style="width: 100%;" placeholder="">
|
||||
<el-option :label="item" :value="item" v-for="(item, index) in digitalInvoiceList[0]"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="税率:" :label-width="labelWidth">
|
||||
<el-select v-model="forms.se_amount" @change="changeevent" style="width: 100%;" placeholder="">
|
||||
<el-option :label="item" :value="item" v-for="(item, index) in digitalInvoiceList[1]"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开票金额:" :label-width="labelWidth">
|
||||
<el-input v-model="forms.price" @change="changeevent" type="number" placeholder="请输入金额"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="开票人账号:" :label-width="labelWidth">
|
||||
<el-select v-model="forms.dlzh" style="width: 100%;" placeholder="">
|
||||
<el-option :label="item.bsryxm" :value="item.dlzh" v-for="(item, index) in Binding"
|
||||
:key="index"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价:" :label-width="labelWidth">
|
||||
<el-input v-model="forms.d_price" disabled placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="税额:" :label-width="labelWidth">
|
||||
<el-input v-model="forms.tax_amount" disabled placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="数量:" :label-width="labelWidth">
|
||||
<el-input v-model="forms.number" type="number" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注:" :label-width="labelWidth">
|
||||
<el-input v-model="forms.notes" type="text" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格型号:" :label-width="labelWidth">
|
||||
<el-input v-model="forms.notes" type="text" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品单位(桌):" :label-width="labelWidth">
|
||||
<el-input v-model="forms.notes" type="number" placeholder=""></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||
<el-button type="primary" :loading="printloading" @click="SubmitEvent">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { getbinding, getindustry, getdigitalInvoice, getstoreSe, getsubInvoicing } from "@/api/application";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
dialogFormVisible: false,
|
||||
forms: {},
|
||||
digitalInvoiceList: [],
|
||||
getindustryList: [],
|
||||
labelWidth: '120px',
|
||||
// 绑定人信息
|
||||
Binding: [],
|
||||
item: "",
|
||||
printloading: false,
|
||||
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getdigitalInvoice()
|
||||
this.getindustry()
|
||||
},
|
||||
methods: {
|
||||
show(d) {
|
||||
this.dialogFormVisible = !this.dialogFormVisible
|
||||
this.item = d
|
||||
this.getbinding()
|
||||
},
|
||||
async changeevent() {
|
||||
let obj = {
|
||||
se_amount: this.forms.se_amount.slice(0, -1),
|
||||
amount: this.forms.price
|
||||
}
|
||||
const res = await getstoreSe(obj)
|
||||
this.forms.d_price = res.d_amount
|
||||
this.forms.tax_amount = res.tx
|
||||
},
|
||||
async SubmitEvent() {
|
||||
this.printloading = true
|
||||
this.forms.se_amount = this.forms.se_amount.slice(0, -1)
|
||||
const res = await getsubInvoicing(this.forms)
|
||||
this.dialogFormVisible = !this.dialogFormVisible
|
||||
this.printloading = false
|
||||
this.$emit('qrcode', res.invoice_records)
|
||||
},
|
||||
// 获取项目分类
|
||||
async getindustry(d = '餐饮') {
|
||||
const res = await getindustry({ article: d })
|
||||
this.getindustryList = res.list
|
||||
},
|
||||
// 获取数电发票类型
|
||||
async getdigitalInvoice() {
|
||||
const res = await getdigitalInvoice()
|
||||
this.digitalInvoiceList = res
|
||||
},
|
||||
// 开票
|
||||
async getbinding(d = "") {
|
||||
const res = await getbinding(d)
|
||||
this.forms = {
|
||||
account: res.bindAccount,
|
||||
dlzh: res.taxation[0].dlzh,
|
||||
article: res.article,
|
||||
type: res.sdType,
|
||||
se_amount: res.taxAmount,
|
||||
number: 1,
|
||||
d_price: '',
|
||||
tax_amount: '',
|
||||
price: this.item.payAmount,
|
||||
cash_out: this.item.orderNo,
|
||||
}
|
||||
this.Binding = res.taxation
|
||||
this.changeevent()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -0,0 +1,188 @@
|
|||
//==本JS是加载Lodop插件或Web打印服务CLodop/Lodop7的综合示例,可直接使用,建议理解后融入自己程序==
|
||||
|
||||
//用双端口加载主JS文件Lodop.js(或CLodopfuncs.js兼容老版本)以防其中某端口被占:
|
||||
var MainJS ="CLodopfuncs.js",
|
||||
URL_WS1 = "ws://localhost:8000/"+MainJS, //ws用8000/18000
|
||||
URL_WS2 = "ws://localhost:18000/"+MainJS,
|
||||
URL_HTTP1 = "http://localhost:8000/"+MainJS, //http用8000/18000
|
||||
URL_HTTP2 = "http://localhost:18000/"+MainJS,
|
||||
URL_HTTP3 = "https://localhost.lodop.net:8443/"+MainJS; //https用8000/8443
|
||||
|
||||
var CreatedOKLodopObject, CLodopIsLocal, LoadJsState;
|
||||
|
||||
//==判断是否需要CLodop(那些不支持插件的浏览器):==
|
||||
function needCLodop() {
|
||||
try {
|
||||
var ua = navigator.userAgent;
|
||||
if (ua.match(/Windows\sPhone/i) ||
|
||||
ua.match(/iPhone|iPod|iPad/i) ||
|
||||
ua.match(/Android/i) ||
|
||||
ua.match(/Edge\D?\d+/i))
|
||||
return true;
|
||||
var verTrident = ua.match(/Trident\D?\d+/i);
|
||||
var verIE = ua.match(/MSIE\D?\d+/i);
|
||||
var verOPR = ua.match(/OPR\D?\d+/i);
|
||||
var verFF = ua.match(/Firefox\D?\d+/i);
|
||||
var x64 = ua.match(/x64/i);
|
||||
if ((!verTrident) && (!verIE) && (x64)) return true;
|
||||
else if (verFF) {
|
||||
verFF = verFF[0].match(/\d+/);
|
||||
if ((verFF[0] >= 41) || (x64)) return true;
|
||||
} else if (verOPR) {
|
||||
verOPR = verOPR[0].match(/\d+/);
|
||||
if (verOPR[0] >= 32) return true;
|
||||
} else if ((!verTrident) && (!verIE)) {
|
||||
var verChrome = ua.match(/Chrome\D?\d+/i);
|
||||
if (verChrome) {
|
||||
verChrome = verChrome[0].match(/\d+/);
|
||||
if (verChrome[0] >= 41) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (err) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//==检查加载成功与否,如没成功则用http(s)再试==
|
||||
//==低版本CLODOP6.561/Lodop7.043及前)用本方法==
|
||||
function checkOrTryHttp() {
|
||||
if (window.getCLodop) {
|
||||
LoadJsState = "complete";
|
||||
return true;
|
||||
}
|
||||
if (LoadJsState == "loadingB" || LoadJsState == "complete") return;
|
||||
LoadJsState = "loadingB";
|
||||
var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
|
||||
var JS1 = document.createElement("script")
|
||||
,JS2 = document.createElement("script")
|
||||
,JS3 = document.createElement("script");
|
||||
JS1.src = URL_HTTP1;
|
||||
JS2.src = URL_HTTP2;
|
||||
JS3.src = URL_HTTP3;
|
||||
JS1.onload = JS2.onload = JS3.onload = JS2.onerror = JS3.onerror=function(){LoadJsState = "complete";}
|
||||
JS1.onerror = function(e) {
|
||||
if (window.location.protocol !== 'https:')
|
||||
head.insertBefore(JS2, head.firstChild); else
|
||||
head.insertBefore(JS3, head.firstChild);
|
||||
}
|
||||
head.insertBefore(JS1,head.firstChild);
|
||||
}
|
||||
|
||||
//==加载Lodop对象的主过程:==
|
||||
(function loadCLodop(){
|
||||
if (!needCLodop()) return;
|
||||
CLodopIsLocal = !!((URL_WS1 + URL_WS2).match(/\/\/localho|\/\/127.0.0./i));
|
||||
LoadJsState = "loadingA";
|
||||
if (!window.WebSocket && window.MozWebSocket) window.WebSocket=window.MozWebSocket;
|
||||
//ws方式速度快(小于200ms)且可避免CORS错误,但要求Lodop版本足够新:
|
||||
try {
|
||||
var WSK1=new WebSocket(URL_WS1);
|
||||
WSK1.onopen = function(e) { setTimeout("checkOrTryHttp()",200); }
|
||||
WSK1.onmessage = function(e) {if (!window.getCLodop) eval(e.data);}
|
||||
WSK1.onerror = function(e) {
|
||||
var WSK2=new WebSocket(URL_WS2);
|
||||
WSK2.onopen = function(e) {setTimeout("checkOrTryHttp()",200);}
|
||||
WSK2.onmessage = function(e) {if (!window.getCLodop) eval(e.data);}
|
||||
WSK2.onerror= function(e) {checkOrTryHttp();}
|
||||
}
|
||||
} catch(e){
|
||||
checkOrTryHttp();
|
||||
}
|
||||
})();
|
||||
|
||||
//==获取LODOP对象主过程,判断是否安装、需否升级:==
|
||||
export function getLodop(oOBJECT, oEMBED) {
|
||||
var strFontTag = "<br><font color='#FF00FF'>打印控件";
|
||||
var strLodopInstall = strFontTag + "未安装!点击这里<a href='install_lodop32.exe' target='_self'>执行安装</a>";
|
||||
var strLodopUpdate = strFontTag + "需要升级!点击这里<a href='install_lodop32.exe' target='_self'>执行升级</a>";
|
||||
var strLodop64Install = strFontTag + "未安装!点击这里<a href='install_lodop64.exe' target='_self'>执行安装</a>";
|
||||
var strLodop64Update = strFontTag + "需要升级!点击这里<a href='install_lodop64.exe' target='_self'>执行升级</a>";
|
||||
var strCLodopInstallA = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动,点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
|
||||
var strCLodopInstallB = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>)";
|
||||
var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>";
|
||||
var strLodop7FontTag = "<br><font color='#FF00FF'>Web打印服务Lodop7";
|
||||
var strLodop7HrefX86 = "点击这里<a href='Lodop7_Linux_X86_64.tar.gz' target='_self'>下载安装</a>(下载后解压,点击lodop文件开始执行)";
|
||||
var strLodop7HrefARM = "点击这里<a href='Lodop7_Linux_ARM64.tar.gz' target='_self'>下载安装</a>(下载后解压,点击lodop文件开始执行)";
|
||||
var strLodop7Install_X86 = strLodop7FontTag + "未安装启动," + strLodop7HrefX86;
|
||||
var strLodop7Install_ARM = strLodop7FontTag + "未安装启动," + strLodop7HrefARM;
|
||||
var strLodop7Update_X86 = strLodop7FontTag + "需升级," + strLodop7HrefX86;
|
||||
var strLodop7Update_ARM = strLodop7FontTag + "需升级," + strLodop7HrefARM;
|
||||
var strInstallOK = ",成功后请刷新本页面或重启浏览器。</font>";
|
||||
var LODOP;
|
||||
try {
|
||||
var isWinIE = (/MSIE/i.test(navigator.userAgent)) || (/Trident/i.test(navigator.userAgent));
|
||||
var isWinIE64 = isWinIE && (/x64/i.test(navigator.userAgent));
|
||||
var isLinuxX86 = (/Linux/i.test(navigator.platform)) && (/x86/i.test(navigator.platform));
|
||||
var isLinuxARM = (/Linux/i.test(navigator.platform)) && (/aarch/i.test(navigator.platform));
|
||||
|
||||
if (needCLodop() || isLinuxX86 || isLinuxARM) {
|
||||
try {
|
||||
LODOP = window.getCLodop();
|
||||
} catch (err) {}
|
||||
if (!LODOP && LoadJsState !== "complete") {
|
||||
if (!LoadJsState)
|
||||
alert("未曾加载Lodop主JS文件,请先调用loadCLodop过程."); else
|
||||
alert("网页还没下载完毕,请稍等一下再操作.");
|
||||
return;
|
||||
}
|
||||
var strAlertMessage;
|
||||
if (!LODOP) {
|
||||
if (isLinuxX86)
|
||||
strAlertMessage = strLodop7Install_X86;
|
||||
else if (isLinuxARM)
|
||||
strAlertMessage = strLodop7Install_ARM;
|
||||
else
|
||||
strAlertMessage = strCLodopInstallA + (CLodopIsLocal ? strCLodopInstallB : "");
|
||||
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
|
||||
return;
|
||||
} else {
|
||||
if (isLinuxX86 && LODOP.CVERSION < "7.0.7.5")
|
||||
strAlertMessage = strLodop7Update_X86;
|
||||
else if (isLinuxARM && LODOP.CVERSION < "7.0.7.5")
|
||||
strAlertMessage = strLodop7Update_ARM;
|
||||
else if (CLODOP.CVERSION < "6.5.9.4")
|
||||
strAlertMessage = strCLodopUpdate;
|
||||
|
||||
if (strAlertMessage)
|
||||
document.body.innerHTML = strAlertMessage + strInstallOK + document.body.innerHTML;
|
||||
}
|
||||
} else {
|
||||
//==如果页面有Lodop插件就直接使用,否则新建:==
|
||||
if (oOBJECT || oEMBED) {
|
||||
if (isWinIE)
|
||||
LODOP = oOBJECT;
|
||||
else
|
||||
LODOP = oEMBED;
|
||||
} else if (!CreatedOKLodopObject) {
|
||||
LODOP = document.createElement("object");
|
||||
LODOP.setAttribute("width", 0);
|
||||
LODOP.setAttribute("height", 0);
|
||||
LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
|
||||
if (isWinIE)
|
||||
LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
|
||||
else
|
||||
LODOP.setAttribute("type", "application/x-print-lodop");
|
||||
document.documentElement.appendChild(LODOP);
|
||||
CreatedOKLodopObject = LODOP;
|
||||
} else
|
||||
LODOP = CreatedOKLodopObject;
|
||||
//==Lodop插件未安装时提示下载地址:==
|
||||
if ((!LODOP) || (!LODOP.VERSION)) {
|
||||
document.body.innerHTML = (isWinIE64 ? strLodop64Install : strLodopInstall) + strInstallOK + document.body.innerHTML;
|
||||
return LODOP;
|
||||
}
|
||||
if (LODOP.VERSION < "6.2.2.6") {
|
||||
document.body.innerHTML = (isWinIE64 ? strLodop64Update : strLodopUpdate) + strInstallOK + document.body.innerHTML;
|
||||
}
|
||||
}
|
||||
//===如下空白位置适合调用统一功能(如注册语句、语言选择等):=======================
|
||||
|
||||
|
||||
//===============================================================================
|
||||
return LODOP;
|
||||
} catch (err) {
|
||||
alert("getLodop出错:" + err);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,10 +141,25 @@
|
|||
<template v-slot="scope"> x{{ scope.row.num }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价">
|
||||
<template v-slot="scope"> ¥{{ scope.row.price }}/ </template>
|
||||
<template v-slot="scope">
|
||||
¥{{ scope.row.price }}
|
||||
<!-- <template v-if="isUseCalcPrice(scope.row)">
|
||||
<div class=""> ¥{{ (scope.row.canReturnAmount / scope.row.num) |to2 }}</div>
|
||||
<div class="line-th"> ¥{{ scope.row.price }}</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-if="isShowGoodsVipPrice(scope.row)">
|
||||
<div class="" > ¥{{ scope.row.memberPrice }}</div>
|
||||
<div class="line-th"> ¥{{ scope.row.price }}</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<div class="" > ¥{{ scope.row.price }}</div>
|
||||
</div>
|
||||
</template> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="小计">
|
||||
<template v-slot="scope"> ¥{{ scope.row.priceAmount }} </template>
|
||||
<template v-slot="scope"> ¥{{ scope.row.canReturnAmount }} </template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作">
|
||||
<template v-slot="scope">
|
||||
|
|
@ -274,6 +289,9 @@ export default {
|
|||
};
|
||||
},
|
||||
filters: {
|
||||
to2(n){
|
||||
return Number(n).toFixed(2)
|
||||
},
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
return t && orderEnum.orderType.find((item) => item.key == t).label;
|
||||
|
|
@ -333,11 +351,9 @@ export default {
|
|||
youHuiJinE() {
|
||||
console.log(this.vipDiscountAmount);
|
||||
const discountAmount=this.detail.discountAmount;
|
||||
const calcDiscountAmount=(this.detail.originAmount*(1-this.detail.discountRatio)).toFixed(2);
|
||||
console.log(this.detail.originAmount*(1-this.detail.discountRatio))
|
||||
const n = $util.numSum([
|
||||
this.vipDiscountAmount,
|
||||
(discountAmount?discountAmount:calcDiscountAmount),
|
||||
discountAmount,
|
||||
this.detail.productCouponDiscountAmount,
|
||||
this.detail.fullCouponDiscountAmount,
|
||||
this.detail.pointsDiscountAmount,
|
||||
|
|
@ -349,6 +365,12 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
isShowGoodsVipPrice(item){
|
||||
return $util.isShowGoodsVipPrice(item);
|
||||
},
|
||||
isUseCalcPrice(item){
|
||||
return $util.isUseCalcPrice(this.detail,item);
|
||||
},
|
||||
close() {
|
||||
console.log("drawer close");
|
||||
this.$emit("close");
|
||||
|
|
@ -391,7 +413,7 @@ export default {
|
|||
tuikuan(item) {
|
||||
this.selGoods = item;
|
||||
console.log(item);
|
||||
this.$refs.refReturnMoney.open(item);
|
||||
this.$refs.refReturnMoney.open({...item,priceAmount:item.canReturnAmount});
|
||||
},
|
||||
tuiCai(item) {
|
||||
this.selGoods = item;
|
||||
|
|
@ -488,7 +510,9 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
.line-th{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.container {
|
||||
padding: 0 20px;
|
||||
font-size: 14px;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ export function canTuicai(orderInfo,item){
|
|||
}
|
||||
export function canTuiKuan(orderInfo,item){
|
||||
// return orderInfo.status!='unpaid'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding'
|
||||
return orderInfo.status=='closed'&& item.status!='return'&&item.status!='refund'&&item.status!='refunding' && !item.userCouponId
|
||||
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'
|
||||
|
|
@ -28,4 +28,17 @@ export function numSum(arr){
|
|||
return a+b*100
|
||||
},0)
|
||||
return (sum/100).toFixed(2)
|
||||
}
|
||||
//是否使用计算的会员价
|
||||
export function isUseCalcPrice(order,item){
|
||||
console.log(order)
|
||||
if(order.fullCouponDiscountAmount>0||order.pointsDiscountAmount>0){
|
||||
return true
|
||||
}else{
|
||||
return false
|
||||
}
|
||||
}
|
||||
//商品列表是否展示会员价
|
||||
export function isShowGoodsVipPrice(item){
|
||||
return item.isMember==1&&item.memberPrice&&item.memberPrice!=item.price
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@
|
|||
<div class="t">总金额</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="item" v-for="item in payCountList" :key="item.payType">
|
||||
<!-- <div class="item" v-for="item in payCountList" :key="item.payType">
|
||||
<div class="icon_wrap" style="--bg-color:#fff">
|
||||
<el-image class="img" :src="item.icon"></el-image>
|
||||
</div>
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<div class="m">¥{{ item.payAmount || 0 }}</div>
|
||||
<div class="t">{{ item.payType }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-container">
|
||||
|
|
@ -150,7 +150,10 @@
|
|||
<template v-slot="scope">
|
||||
<div class="u-flex gap-10">
|
||||
<el-button type="text" @click="$refs.orderDetail.show(scope.row)">详情</el-button>
|
||||
<el-button v-if="scope.row.status == 'unpaid'" type="primary" size="mini" @click="payOrder(scope.row)">结账</el-button>
|
||||
<el-button type="text" v-if="scope.row.status == 'closed'"
|
||||
@click="$refs.Invoicing.show(scope.row)">开票</el-button>
|
||||
<el-button v-if="scope.row.status == 'unpaid'" type="primary" size="mini"
|
||||
@click="payOrder(scope.row)">结账</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -162,20 +165,38 @@
|
|||
layout="total, sizes, prev, pager, next, jumper"></el-pagination>
|
||||
</div>
|
||||
<orderDetail ref="orderDetail" @close="getTableData" />
|
||||
<!-- 开票 -->
|
||||
<Invoicing ref="Invoicing" @qrcode="qrcodeEvent"></Invoicing>
|
||||
<!-- 二维码 -->
|
||||
<div class="qrStyle" v-if="isuppop">
|
||||
<div class="box">
|
||||
<div> <span></span> {{ codeinfo.type }}<i class="el-icon-close" @click="isuppopEvent()"></i> </div>
|
||||
<canvas ref="canvas" id="canvas"></canvas>
|
||||
<div>
|
||||
税率:{{ codeinfo.se_amount + '%' }}
|
||||
金额:{{ codeinfo.price }}<br />
|
||||
<div style="color: red;margin-top: 5px;"> {{ codeinfo.string1 }} </div> <br />
|
||||
<el-button type="primary" style="margin-top: 10px;" @click="printEvent(codeinfo)">打印</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import orderEnum from "./orderEnum";
|
||||
import { getLodop } from "./components/LodopFuncs.js";
|
||||
import { tbShopPayTypeGet } from "@/api/setting";
|
||||
import { tbOrderInfoData, tbOrderInfoDownload, payCount } from "@/api/order";
|
||||
import dayjs from "dayjs";
|
||||
import { downloadFile } from "@/utils/index";
|
||||
import QRCode from "qrcode";
|
||||
|
||||
import orderDetail from "./components/orderDetail";
|
||||
import Invoicing from "./components/Invoicing";
|
||||
|
||||
export default {
|
||||
components: { orderDetail },
|
||||
components: { orderDetail, Invoicing },
|
||||
data() {
|
||||
return {
|
||||
orderEnum,
|
||||
|
|
@ -200,31 +221,34 @@ export default {
|
|||
},
|
||||
downloadLoading: false,
|
||||
payCountList: "",
|
||||
payCountTotal: 0
|
||||
payCountTotal: 0,
|
||||
isuppop: false,
|
||||
codeinfo: "",
|
||||
};
|
||||
},
|
||||
|
||||
filters: {
|
||||
orderTypeFilter(t) {
|
||||
if (t) {
|
||||
const item= orderEnum.orderType.find(item => item.key == t);
|
||||
return t && item?item.label:'';
|
||||
const item = orderEnum.orderType.find(item => item.key == t);
|
||||
return t && item ? item.label : '';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
|
||||
sendTypeFilter(t) {
|
||||
if (t) {
|
||||
const item= orderEnum.sendType.find(item => item.key == t);
|
||||
return item?item.label:'';
|
||||
const item = orderEnum.sendType.find(item => item.key == t);
|
||||
return item ? item.label : '';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
},
|
||||
statusFilter(t) {
|
||||
if (t) {
|
||||
const item= orderEnum.status.find(item => item.key == t);
|
||||
return t && item?item.label:'';
|
||||
const item = orderEnum.status.find(item => item.key == t);
|
||||
return t && item ? item.label : '';
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
|
|
@ -234,6 +258,8 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
|
||||
if (this.$route.query.tableName) {
|
||||
this.query.tableName = this.$route.query.tableName
|
||||
}
|
||||
|
|
@ -254,11 +280,57 @@ export default {
|
|||
this.getTableData();
|
||||
}, 200);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
printEvent(data) {
|
||||
console.log('打印方法执行', data)
|
||||
let LODOP = getLodop();
|
||||
LODOP.PRINT_INIT("打印小票");
|
||||
LODOP.SET_PRINTER_INDEX('MHT-POS58');//设置默认打印机(这里用的是打印机名称)
|
||||
// 设置打印纸大小D
|
||||
LODOP.SET_PRINT_PAGESIZE(3, 800, '', '')
|
||||
// 二维码控制大小
|
||||
LODOP.ADD_PRINT_BARCODE('', '30px', '150px', '150px', 'QRCode', data.url) //打印产品代码条码
|
||||
LODOP.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width ') //设置打印风格,这里是等宽打印
|
||||
LODOP.SET_PRINT_STYLE("Alignment", 2);
|
||||
// 文字内容
|
||||
LODOP.ADD_PRINT_HTM(
|
||||
'150px',
|
||||
'5px',
|
||||
'100%',
|
||||
'100%',
|
||||
`<div style="width: 100%;font-size: 12px; ">项目分类:${data.article}</div>
|
||||
<div style="width: 100%;font-size: 12px; margin-top:6px;">发票类型:${data.type}</div>
|
||||
<div style="width: 100%;font-size: 12px; margin-top:6px;">生成时间:${dayjs().format('YYYY-MM-DD HH:mm:ss')}</div>
|
||||
<div style="width: 100%;font-size: 12px; margin-top:6px;">*二维码有效期30天,超过自动失效!</div>
|
||||
<div style="width: 100%;font-size: 14px; margin-top: 15px;">您可以使用微信,扫码开票</div>`
|
||||
)
|
||||
LODOP.SET_LICENSES('', 'DCFF409304DFCEB3E2C644BF96CD0720', '', '')
|
||||
LODOP.PRINT()
|
||||
|
||||
},
|
||||
qrcodeEvent(d) {
|
||||
this.codeinfo = d
|
||||
this.isuppopEvent()
|
||||
setTimeout(() => {
|
||||
QRCode.toCanvas(
|
||||
this.$refs.canvas,
|
||||
this.codeinfo.url, {
|
||||
width: 160,
|
||||
height: 160,
|
||||
}, function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
}, 500);
|
||||
|
||||
},
|
||||
isuppopEvent() {
|
||||
this.isuppop = !this.isuppop
|
||||
},
|
||||
//结账
|
||||
payOrder(order){
|
||||
payOrder(order) {
|
||||
console.log(order);
|
||||
this.$router.push({
|
||||
path: "/tool/Instead/index",
|
||||
|
|
@ -268,7 +340,7 @@ export default {
|
|||
useType: order.useType,
|
||||
masterId: order.masterId,
|
||||
orderId: order.id,
|
||||
key:'isJieZhang'
|
||||
key: 'isJieZhang'
|
||||
},
|
||||
});
|
||||
},
|
||||
|
|
@ -324,7 +396,7 @@ export default {
|
|||
async getTableData(switchs = false) {
|
||||
this.tableData.loading = true;
|
||||
try {
|
||||
this.payCount();
|
||||
// this.payCount();
|
||||
const productName = this.query.productName.replace(/\s+/g, '')
|
||||
const res = await tbOrderInfoData({
|
||||
page: this.tableData.page,
|
||||
|
|
@ -543,4 +615,40 @@ export default {
|
|||
.colorStyle {
|
||||
color: #ffc315;
|
||||
}
|
||||
|
||||
.qrStyle {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba($color: #000000, $alpha: 0.7);
|
||||
position: fixed;
|
||||
z-index: 999999;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
.box {
|
||||
width: 380px;
|
||||
height: 320px;
|
||||
position: absolute;
|
||||
background: #fff;
|
||||
top: 26%;
|
||||
left: 36%;
|
||||
padding: 18px;
|
||||
|
||||
>div:first-child {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
margin-left: 49%;
|
||||
transform: translateX(-80px);
|
||||
}
|
||||
|
||||
>div:last-child {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -286,11 +286,13 @@ export default {
|
|||
//相同商品抵扣券数组
|
||||
const arr = this.quans.productCoupon.filter((v) => v.proId == row.proId);
|
||||
const index = arr.findIndex((v) => v.id == row.id);
|
||||
const item=this.goodsArr.find((v) => v.productId == row.proId);
|
||||
if (index != -1) {
|
||||
const n=returnProductCoupAllPrice(
|
||||
$goodsPayPriceMap[row.proId],
|
||||
index,
|
||||
row.num
|
||||
row.num,
|
||||
item.isMember
|
||||
)
|
||||
return (n*this.discount).toFixed(2);
|
||||
} else {
|
||||
|
|
@ -385,7 +387,7 @@ export default {
|
|||
.catch(() => {});
|
||||
}
|
||||
if (this.fullReductionCouponSel.fullAmount > payPrice) {
|
||||
this.$confirm(
|
||||
this.$confirm(
|
||||
"选择该商品券后将不满足选择抵扣券的最低满减需求,继续选择将取消选择的满减券",
|
||||
"提示",
|
||||
{
|
||||
|
|
@ -399,7 +401,11 @@ export default {
|
|||
id: "",
|
||||
};
|
||||
})
|
||||
.catch(() => {});
|
||||
.catch(() => {
|
||||
item.checked=false
|
||||
const index = this.quansSelArr.findIndex((v) => v.id == item.id);
|
||||
this.quansSelArr.splice(index, 1);
|
||||
});
|
||||
}
|
||||
}
|
||||
item.checked = !item.checked;
|
||||
|
|
@ -441,7 +447,6 @@ export default {
|
|||
async open(data, propSelCoup) {
|
||||
console.log(data);
|
||||
this.orderPrice = data.orderPrice;
|
||||
this.discount=data.discount||1
|
||||
this.quansSelArr = [...propSelCoup];
|
||||
$goodsPayPriceMap = returnGoodsPayPriceMap(this.goodsArr || []);
|
||||
if (data.memberId) {
|
||||
|
|
|
|||
|
|
@ -1065,16 +1065,11 @@
|
|||
</div>
|
||||
<div class="detail_form_item">
|
||||
<div class="left">积分抵扣</div>
|
||||
<div class="right">-¥{{ points.toMoney | to2 }}</div>
|
||||
<div class="right">-¥{{ pointsDiscountAmount | to2 }}</div>
|
||||
</div>
|
||||
<div class="detail_form_item">
|
||||
<div class="left">整单改价</div>
|
||||
<div class="right">
|
||||
-¥{{
|
||||
((1 - createOrder.discount) * createOrder.data.amount)
|
||||
| to2
|
||||
}}
|
||||
</div>
|
||||
<div class="right">-¥{{ gaijia | to2 }}</div>
|
||||
</div>
|
||||
<div class="detail_form_item" v-if="createOrder.data.packFee">
|
||||
<div class="left">打包费</div>
|
||||
|
|
@ -1718,6 +1713,22 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
pointsDiscountAmount() {
|
||||
if (this.points.selected) {
|
||||
return this.points.toMoney;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
gaijia() {
|
||||
const disCountOriginPrice =
|
||||
this.createOrder.data.amount - this.coupdiscount;
|
||||
const disocunt = (1 - this.createOrder.discount) * disCountOriginPrice;
|
||||
return disocunt.toFixed(2);
|
||||
},
|
||||
pointsCanDicountMoney() {
|
||||
return (this.yinFuJinE - this.points.toMoney).toFixed(2);
|
||||
},
|
||||
isShowVipPrice() {
|
||||
if (!this.shopInfo.isMemberPrice) {
|
||||
return false;
|
||||
|
|
@ -1725,44 +1736,22 @@ export default {
|
|||
return this.vipUser.isVip ? true : false;
|
||||
},
|
||||
coupdiscount() {
|
||||
return (this.createOrder.discount*returnCouponAllPrice(
|
||||
this.quansSelArr,
|
||||
this.createOrder.data.detailList || [],
|
||||
this.vipUser
|
||||
)).toFixed(2)
|
||||
const n = this.quansSelArr.reduce((prve, cur) => {
|
||||
return prve + cur.discountAmount * 1;
|
||||
}, 0);
|
||||
return n;
|
||||
},
|
||||
goodsDisCount() {
|
||||
const goodsQuanArr = this.quansSelArr.filter((v) => v.type == 2);
|
||||
let result = 0;
|
||||
if (goodsQuanArr.length < 0) {
|
||||
result = 0;
|
||||
} else {
|
||||
result = goodsQuanArr.reduce((a, b) => {
|
||||
const item = this.createOrder.data.detailList.find(
|
||||
(v) => v.productId == b.proId
|
||||
);
|
||||
const memberPrice = item.memberPrice ? item.memberPrice : item.price;
|
||||
const price = item
|
||||
? this.vipUser.isVip
|
||||
? memberPrice
|
||||
: item.price
|
||||
: 0;
|
||||
return a + price;
|
||||
}, 0);
|
||||
}
|
||||
return result.toFixed(2);
|
||||
},
|
||||
|
||||
currentPayMoney() {
|
||||
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.createOrder.discount - this.coupdiscount;
|
||||
const total = amount - this.gaijia - this.coupdiscount;
|
||||
return total <= 0 ? 0 : total;
|
||||
},
|
||||
yinFuJinE() {
|
||||
const total = this.currentPayMoney - (this.points.toMoney || 0);
|
||||
console.log(total)
|
||||
const total =
|
||||
this.currentPayMoney - (this.points.selected ? this.points.toMoney : 0);
|
||||
console.log(total);
|
||||
if (this.isCreateOrder) {
|
||||
return total.toFixed(2);
|
||||
} else {
|
||||
|
|
@ -1886,13 +1875,20 @@ export default {
|
|||
const seatFee =
|
||||
this.order.seatFee.totalAmount *
|
||||
(returnStatus.includes(this.order.seatFee.status) ? 0 : 1);
|
||||
// return (
|
||||
// (oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
|
||||
// this.createOrder.discount
|
||||
// ).toFixed(2);
|
||||
return (
|
||||
(oldPrice + price + +packFee + seatFee - this.youhuiAllPrice) *
|
||||
this.createOrder.discount
|
||||
oldPrice +
|
||||
price +
|
||||
+packFee +
|
||||
seatFee -
|
||||
this.youhuiAllPrice
|
||||
).toFixed(2);
|
||||
},
|
||||
vipDiscountPrice() {
|
||||
if (!this.vipUser.isVip) {
|
||||
if (!this.vipUser.isVip || !this.shopInfo.isMemberPrice) {
|
||||
return 0;
|
||||
}
|
||||
const oldMemberPrice = this.order.old.list.reduce((a, b) => {
|
||||
|
|
@ -1990,10 +1986,15 @@ export default {
|
|||
this.goods.status = "loadmore";
|
||||
this.getGoods();
|
||||
},
|
||||
pointsCanDicountMoney: function (newval) {
|
||||
this.getCalcUsablePoints();
|
||||
},
|
||||
currentPayMoney: function (newval) {
|
||||
if (this.createOrder.data.memberId || this.vipUser.id) {
|
||||
this.getCalcUsablePoints().then((res) => {
|
||||
this.pointsValueChange(this.points.value);
|
||||
if (this.points.selected) {
|
||||
this.pointsValueChange(this.points.value);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
@ -2054,8 +2055,12 @@ export default {
|
|||
if (this.order.status == "finish") {
|
||||
return;
|
||||
}
|
||||
if(!this.table.tableId&&(this.order.list.length<=0&&this.order.old.list.length<=0)){
|
||||
return ;
|
||||
if (
|
||||
!this.table.tableId &&
|
||||
this.order.list.length <= 0 &&
|
||||
this.order.old.list.length <= 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
$setUser({
|
||||
tableId: this.table.tableId,
|
||||
|
|
@ -2194,13 +2199,18 @@ export default {
|
|||
//相同商品抵扣券数组
|
||||
const arr = this.quansSelArr.filter((v) => v.proId == row.proId);
|
||||
const index = arr.findIndex((v) => v.id == row.id);
|
||||
const item = this.createOrder.data.detailList.find(
|
||||
(v) => v.productId == row.proId
|
||||
);
|
||||
|
||||
if (index != -1) {
|
||||
const n=returnProductCoupAllPrice(
|
||||
const n = returnProductCoupAllPrice(
|
||||
$goodsPayPriceMap[row.proId],
|
||||
index,
|
||||
row.num
|
||||
)
|
||||
return (n*this.createOrder.discount).toFixed(2);
|
||||
row.num,
|
||||
item.isMember
|
||||
);
|
||||
return (n * this.createOrder.discount).toFixed(2);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -2213,6 +2223,13 @@ export default {
|
|||
console.log(index);
|
||||
if (index != -1) {
|
||||
this.quansSelArr.splice(index, 1);
|
||||
this.quansSelArr
|
||||
.map((v, index) => {
|
||||
return {
|
||||
...v,
|
||||
discountAmount:v.type==2?this.returnProDiscount(v):v.discountAmount,
|
||||
};
|
||||
});
|
||||
}
|
||||
},
|
||||
async getCalcUsablePoints() {
|
||||
|
|
@ -2232,6 +2249,9 @@ export default {
|
|||
this.vipUser.accountPoints,
|
||||
this.points.res.maxUsablePoints || 0
|
||||
);
|
||||
if(!pointsRes.usable){
|
||||
this.points.selected=false
|
||||
}
|
||||
}
|
||||
return pointsRes;
|
||||
},
|
||||
|
|
@ -2266,13 +2286,21 @@ export default {
|
|||
id: this.createOrder.data.id,
|
||||
memberId: this.createOrder.data.memberId || this.vipUser.id,
|
||||
orderPrice: (this.yinFuJinE * 1 + this.coupdiscount * 1).toFixed(2),
|
||||
discount:this.createOrder.discount
|
||||
discount: this.createOrder.discount,
|
||||
},
|
||||
[...this.quansSelArr]
|
||||
);
|
||||
},
|
||||
quansConfirm(e, goodsPayPriceMap) {
|
||||
console.log(e);
|
||||
this.createOrder.discount = 1;
|
||||
this.points.selected = "";
|
||||
e.map((v, index) => {
|
||||
return {
|
||||
...v,
|
||||
discountAmount:v.type==2? this.returnProDiscount(v):v.discountAmount,
|
||||
};
|
||||
});
|
||||
this.quansSelArr = [...e];
|
||||
$goodsPayPriceMap = goodsPayPriceMap;
|
||||
},
|
||||
|
|
@ -2320,7 +2348,7 @@ export default {
|
|||
// return
|
||||
// }
|
||||
await this.returnCreateOrderData();
|
||||
this.payBeforeClear();
|
||||
// this.payBeforeClear();
|
||||
// this.order.payType = "";
|
||||
},
|
||||
async cashPayClick() {
|
||||
|
|
@ -2413,10 +2441,13 @@ export default {
|
|||
if (!canJiesuan) {
|
||||
return;
|
||||
}
|
||||
const order = await this.returnCreateOrderData();
|
||||
this.order.payType = "scanCode";
|
||||
this.payTypeItemClick({ payType: "scanCode", order });
|
||||
this.payBeforeClear();
|
||||
if (!this.isCreateOrder) {
|
||||
const order = await this.returnCreateOrderData();
|
||||
this.order.payType = "scanCode";
|
||||
this.payTypeItemClick({ payType: "scanCode", order });
|
||||
return;
|
||||
}
|
||||
this.payTypeItemClick({ payType: "scanCode" });
|
||||
},
|
||||
async changeOrderUseType(useType) {
|
||||
if (useType && this.order.list.length) {
|
||||
|
|
@ -2553,10 +2584,11 @@ export default {
|
|||
},
|
||||
//退菜
|
||||
async refReturnCartConfirm(e) {
|
||||
console.log(this.order.selGoods);
|
||||
const res = await $returnCart({
|
||||
...e,
|
||||
cartId: this.order.selGoods.cartId,
|
||||
cartId: this.isCreateOrder
|
||||
? this.order.selGoods.id
|
||||
: this.order.selGoods.cartId,
|
||||
tableId: this.table.tableId,
|
||||
});
|
||||
this.order.selGoods.status = "return";
|
||||
|
|
@ -2675,14 +2707,41 @@ export default {
|
|||
}
|
||||
},
|
||||
ChangeDiscount(discount) {
|
||||
const fullCoupIndex = this.quansSelArr.findIndex((v) => v.type == 1);
|
||||
const fullCoup = this.quansSelArr[fullCoupIndex];
|
||||
this.createOrder.discount = discount;
|
||||
if (fullCoup && this.yinFuJinE < fullCoup.fullAmount) {
|
||||
return this.$confirm(
|
||||
"改价后价格不满足满减券最低满减需求" + fullCoup.fullAmount + "元",
|
||||
"提示",
|
||||
{
|
||||
confirmButtonText: "删除满减券",
|
||||
cancelButtonText: "取消改价",
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.quansSelArr.splice(fullCoupIndex, 1);
|
||||
this.createOrder.discount = discount;
|
||||
})
|
||||
.catch((action) => {
|
||||
this.createOrder.discount = 1;
|
||||
this.$message({
|
||||
type: "info",
|
||||
message: "已取消改价",
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
async disCountShow() {
|
||||
const canDiscount = await hasPermission("允许打折");
|
||||
if (!canDiscount) {
|
||||
return;
|
||||
}
|
||||
const amount = this.createOrder.data.amount;
|
||||
const amount = (this.createOrder.data.amount - this.coupdiscount).toFixed(
|
||||
2
|
||||
);
|
||||
console.log(amount);
|
||||
this.refToggle("refDiscount", true, {
|
||||
amount,
|
||||
discount: this.createOrder.discount * 100,
|
||||
|
|
@ -4516,11 +4575,13 @@ input[type="number"]::-webkit-outer-spin-button {
|
|||
font-weight: 600;
|
||||
}
|
||||
::v-deep input[aria-hidden="true"] {
|
||||
display: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
::v-deep .el-radio:focus:not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner {
|
||||
box-shadow: none !important;
|
||||
|
||||
::v-deep
|
||||
.el-radio:focus:not(.is-focus):not(:active):not(.is-disabled)
|
||||
.el-radio__inner {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
::v-deep .categorys .el-tag--plain.el-tag--info {
|
||||
|
|
|
|||
|
|
@ -91,11 +91,12 @@ export function returnProductPayPrice(goods,vipUser){
|
|||
return price
|
||||
}
|
||||
//返回商品券抵扣的商品价格
|
||||
export function returnProductCoupAllPrice(productPriceArr,startIndex,num){
|
||||
export function returnProductCoupAllPrice(productPriceArr,startIndex,num,isMember=true){
|
||||
console.log(productPriceArr);
|
||||
return productPriceArr.slice(startIndex,startIndex+num).reduce((prve,cur)=>{
|
||||
let curPrice=0
|
||||
if(typeof cur==='object'){
|
||||
curPrice=cur.memberPrice*1
|
||||
curPrice=isMember?cur.memberPrice*1:cur.price
|
||||
}else{
|
||||
curPrice=cur*1
|
||||
}
|
||||
|
|
@ -216,9 +217,9 @@ export function returnCouponAllPrice(coupArr, goodsArr, vipUser) {
|
|||
export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
||||
return coupArr.map(v => {
|
||||
if (v.id == selCoup.id) {
|
||||
return v
|
||||
return {...v,use:true}
|
||||
}
|
||||
const isfullAmount = payPrice >= v.fullAmount * 1
|
||||
const isfullAmount = payPrice*1 >= v.fullAmount * 1
|
||||
if(payPrice<=0){
|
||||
return {
|
||||
...v,
|
||||
|
|
@ -229,5 +230,21 @@ export function returnCanUseFullReductionCoupon(coupArr, payPrice, selCoup) {
|
|||
...v,
|
||||
use: v.use && isfullAmount
|
||||
}
|
||||
})
|
||||
}).filter(v => v.use)
|
||||
}
|
||||
|
||||
//根据商品数量还有商品券数量返回优惠券可以使用的数量数组
|
||||
export function returnCanUseNumProductCoup(coupArr,){
|
||||
let productCoup = coupArr.filter(v => v.type == 2)
|
||||
//商品券分组
|
||||
let coupMap={}
|
||||
for(let i in productCoup){
|
||||
const coup=productCoup[i]
|
||||
if(coupMap.hasOwnProperty(coup.proId)){
|
||||
coupMap[coup.proId].push(coup)
|
||||
}else{
|
||||
coupMap[coup.proId]=[coup]
|
||||
}
|
||||
}
|
||||
return arr
|
||||
}
|
||||
Loading…
Reference in New Issue