From eee12698214d01e69c438dc6ab777a225a43a82a Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 28 Apr 2021 15:58:41 +0800
Subject: [PATCH] 20210428 抽奖
---
zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html | 233 ++++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 176 insertions(+), 57 deletions(-)
diff --git a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
index 6b88037..58db52c 100644
--- a/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
+++ b/zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/orderXq-form.html
@@ -22,7 +22,7 @@
.ibox-content {
background-color: rgba(240, 242, 245, 1);
}
- label {
+ .aside label {
width: 100%;
margin: 5px 0 !important;
}
@@ -74,7 +74,7 @@
</head>
<div class="ibox-content" id="app">
<el-container>
- <el-aside style="width: 300px; background-color: white; padding: 10px;">
+ <el-aside class="aside" style="width: 300px; background-color: white; padding: 10px;">
<el-row style="border-bottom: #E4E7ED 1px solid;">
<el-col :span="20" style="padding: 10px;">
<el-row type="flex" align="middle">
@@ -104,15 +104,16 @@
<label style="font-size: 14px;">应收金额</label>
<label>欠款</label>
<label>已还</label>
- <label>退款</label>
+ <label v-if="order.refund != 0">退款</label>
</el-col>
<el-col :span="14" style="text-align: right;">
<label>¥ {{order.total}}</label>
- <label>¥ {{order.zkTotal - order.total}}</label>
+ <!-- 退款订单不能显示为负数 -->
+ <label>¥ {{(order.zkTotal - order.total>0?order.zkTotal - order.total:0).toFixed(2)}}</label>
<label>¥ {{order.zkTotal}}</label>
<label>¥ {{order.arrears}}</label>
<label>¥ {{order.repay}}</label>
- <label>¥ {{order.refund}}</label>
+ <label v-if="order.refund != 0">¥ {{order.refund}}</label>
</el-col>
</el-row>
</el-col>
@@ -133,14 +134,14 @@
</el-col>
</el-row>
<el-row type="flex" justify="center" style="margin: 20px;">
- <el-button size="medium" type="primary">打印</el-button>
+ <el-button size="medium" type="primary" @click="printf">打印</el-button>
</el-row>
</el-aside>
<el-main style="background-color: white; margin-right: 15px; margin-left: 15px; padding: 20px 30px;">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="订单明细" name="first">
<el-row>
- <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款</el-button>
+ <el-button size="mini" type="primary" @click="openPayMoneyDialog" v-if="isRefund">提交退款<span v-if="totalRefund"> ¥ {{totalRefund}}</span></el-button>
<el-button size="mini" type="danger" @click="isRefund = false" v-if="isRefund">取消</el-button>
<el-button size="mini" type="primary" @click="isRefund = true" v-if="order.statu == '已付款' && !isRefund">退款</el-button>
</el-row>
@@ -180,6 +181,8 @@
</el-table-column>
<el-table-column label="小计" :formatter="calOrderTotalFormatter">
</el-table-column>
+ <el-table-column label="支付方式" prop="payMethod">
+ </el-table-column>
</el-table>
</el-row>
<el-row v-show="isRefund">
@@ -214,12 +217,12 @@
</el-table-column>
<el-table-column label="退款单价">
<template slot-scope="scope">
- <el-input v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input>
+ <el-input @change="calRefund" v-model="scope.row.refundPrice" v-if="scope.row.count > 0"></el-input>
</template>
</el-table-column>
<el-table-column label="退款数量">
<template slot-scope="scope">
- <el-input v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input>
+ <el-input @change="calRefund" v-model.number="scope.row.refundCount" v-if="scope.row.count > 0"></el-input>
</template>
</el-table-column>
<el-table-column label="是否退库存" align="center">
@@ -254,11 +257,15 @@
label="收款">
</el-table-column>
<el-table-column
- prop="t3"
+ prop="payMethod"
+ label="支付方式">
+ </el-table-column>
+ <el-table-column
+ prop="achieveType"
label="业绩类型">
</el-table-column>
<el-table-column
- prop="t1"
+ prop="goodsCash"
label="原业绩">
</el-table-column>
<el-table-column
@@ -307,16 +314,33 @@
prop="zkTotal"
label="收款">
</el-table-column>
+
+ <el-table-column
+ label="支付方式"
+ width="130">
+ <template slot-scope="scope">
+ <el-select v-model="scope.row.payMethod"
+ placeholder="请选择支付方式">
+ <el-option
+ v-for="item in itemSimplePayMethods"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ :disabled="item.disabled">
+ </el-option>
+ </el-select>
+ </template>
+ </el-table-column>
<el-table-column
prop="t3"
label="业绩类型">
<template slot-scope="scope">
- <el-select v-model="scope.row.t3" placeholder="请选择业绩类型">
+ <el-select v-model="scope.row.achieveType" placeholder="请选择业绩类型">
<el-option
v-for="item in achieveTypeList"
- :key="item.key"
+ :key="item.value"
:label="item.value"
- :value="item.key">
+ :value="item.value">
</el-option>
</el-select>
</template>
@@ -325,7 +349,7 @@
prop="achieve"
label="业绩">
<template slot-scope="scope">
- <el-input v-model="scope.row.t1"></el-input>
+ <el-input @input="checkAchieveMoney" v-model="scope.row.goodsCash"></el-input>
</template>
</el-table-column>
<el-table-column
@@ -354,9 +378,9 @@
size="mini"
@click="delAchieve(scope.$index, scope.row)">删除
</el-button>
- <el-tooltip content="分享业绩" placement="top">
- <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
- size="mini" type="primary"></el-button>
+ <el-tooltip content="分享业绩" placement="top" v-if="!scope.row.isShare">
+ <el-button @click="shareAchieve(scope.$index, scope.row)" icon="el-icon-share"
+ size="mini" type="primary"></el-button>
</el-tooltip>
</template>
</el-table-column>
@@ -379,6 +403,10 @@
prop="flowContent"
label="交易内容"
width="300">
+ </el-table-column>
+ <el-table-column
+ prop="createTime"
+ label="交易时间">
</el-table-column>
<el-table-column
prop="flowType"
@@ -430,7 +458,7 @@
@check="(click, checked,$item)=>{handleCheckChange(click, checked,$item)}"
:props="defaultProps">
</el-tree>
- <li :class="{active : item.isActive}" slot="reference" @click="payMethodSelect(item, index)"><div style="line-height: 30px;"><img style="width: 25px; height: 25px;" :src="item.img"><span style="line-height: 30px; margin-left: 5px;">{{item.value}}</span></div></li>
+ <li :class="{active : item.isActive}" slot="reference" @click="payMethodSelect(item, index)"><div style=" height:30px; line-height: 30px; display: flex; align-items: center"><img style="width: 25px; height: 25px; align-items: center;" :src="item.img"><span style="margin-left: 5px;">{{item.value}}</span></div></li>
</el-popover>
</span>
</ul>
@@ -449,9 +477,9 @@
</el-col>
</el-row>
-<!-- <el-row style="text-align: center; margin: 20px 0 10px 0">-->
-<!-- <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
-<!-- </el-row>-->
+ <!-- <el-row style="text-align: center; margin: 20px 0 10px 0">-->
+ <!-- <el-checkbox v-model="printPaper">打印小票</el-checkbox>-->
+ <!-- </el-row>-->
<el-row style="text-align: center; margin: 10px 0 0 0">
<el-button type="primary" @click="confirmSubmit">确认收款</el-button>
@@ -478,21 +506,21 @@
activeName : "first",
circleUrl : "https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png",
userList : [],
- achieveTypeList : [
- {
- "key" : "现金业绩",
- "value" : "现金业绩"
- },{
- "key" : "划扣业绩",
- "value" : "划扣业绩"
- },
- ],
+ achieveTypeList : [],
orderItems : [],
achieveItems : [],
flowItems : [],
payMethodItems : [],
isRefund : false,
isReturnAchieve : false,
+ totalRefund : "",
+ itemSimplePayMethods:[{
+ value: '现金',
+ label:'现金',
+ },{
+ value: '划扣',
+ label:'划扣',
+ }],
payMethods: [{
value: '现金支付',
img: '/images/pay/cash.png',
@@ -525,7 +553,7 @@
type: '储值卡'
}, ],
- dialogSettleVisible : true,
+ dialogSettleVisible : false,
moneyCards: [],
defaultProps: {
children: 'children',
@@ -541,15 +569,42 @@
created : function() {
let _this = this;
this.orderParam = /*[[${orderParam}]]*/
- this.queryOrderDetailData(this.orderParam);
+ var orderId = /*[[${orderId}]]*/
+ var orderNo = /*[[${orderNo}]]*/
+ var param = {};
+ if(orderId) {
+ param.id = orderId;
+ } else {
+ param.orderNo = orderNo;
+ }
+ this.queryOrderDetailData(param);
+ // 业绩类型
+ AjaxProxy.requst({
+ app: _this,
+ url: basePath + '/admin/customerDictionary/getListByParentCode/YJLX',
+ callback: function (data) {
+ _this.achieveTypeList = data.rows;
+ }
+ });
},
methods : {
+ calRefund() {
+ let _this = this;
+ var total = 0;
+ _this.orderItems.forEach(item => {
+ if (item.refundPrice && item.refundCount) {
+ total += parseFloat(item.refundPrice * item.refundCount);
+ }
+ })
+
+ _this.totalRefund = total;
+ },
queryOrderDetailData(param) {
let _this = this;
AjaxProxy.requst({
app: _this,
- data: {id: param, orderNo:param},
+ data: param,
contentType: 'application/x-www-form-urlencoded',
url: basePath + '/admin/order/findOrderDetailByIdOrNo',
callback: function (data) {
@@ -643,6 +698,10 @@
}
_this.data.items = dataItems;
+ _this.data.zkTotal = _this.refundMoney;
+ _this.data.total = _this.total;
+
+
AjaxProxy.requst({
app: _this,
data: _this.data,
@@ -651,7 +710,9 @@
callback: function (data) {
_this.isRefund = false;
_this.dialogSettleVisible = false;
- _this.queryOrderDetailData(_this.data.oldOrderId);
+ var param = {};
+ param.id = _this.data.oldOrderId;
+ _this.queryOrderDetailData(param);
}
});
@@ -680,6 +741,11 @@
this.$message.warning("输入付款总金额与应付金额不符");
return false;
}
+
+ if(_this.order.zkTotal - _this.order.refund - _this.order.arrears < total) {
+ this.$message.warning("退款金额不能超过收款金额");
+ return false;
+ }
_this.data.flows = flows;
return true;
} else {
@@ -691,6 +757,7 @@
let _this = this;
let items = this.orderItems;
_this.refundMoney = 0;
+ _this.total = 0;
for(var i = 0; i < items.length; i++) {
let item = items[i]
@@ -706,6 +773,8 @@
}
_this.refundMoney += parseFloat(item.refundPrice * item.refundCount);
+ //记录一下未优惠之前的价格
+ _this.total += parseFloat(item.price * item.refundCount);
}
}
@@ -716,7 +785,7 @@
_this.dialogSettleVisible = true;
},
calOrderTotalFormatter(row, column) {
- return row.count * row.price;
+ return row.count * row.zkPrice;
},
getVipMoneyCards() {
let _this = this;
@@ -771,6 +840,13 @@
}
} else {
Vue.set(item,'isActive',true);
+ var hasAmount = 0;
+ for(var i = 0; i < payMoneys.length; i++) {
+ hasAmount += parseFloat(payMoneys[i].money);
+ }
+ if (_this.refundMoney - hasAmount > 0) {
+ Vue.set(item, 'money', _this.refundMoney - hasAmount);
+ }
_this.payMoneys.push(item);
}
});
@@ -827,34 +903,77 @@
},
saveAchieve() {
let _this = this;
- AjaxProxy.requst({
- app: _this,
- data: _this.achieveItems,
- contentType: 'application/json',
- url: basePath + '/admin/achieve/add',
- callback: function (data) {
- _this.$message.success(data.info);
- }
- });
- },
- shareAchieve(index, row) {
- var row2 = JSON.parse(JSON.stringify(row));
- row2.id = null;
- row2.isShare = true;
- this.achieveItems.push(row2);
- },
- delAchieve(index, row) {
- let _this = this;
- if (row.id) {
+ if(_this.checkAchieveMoney()){
AjaxProxy.requst({
app: _this,
- url: basePath + '/admin/achieve/del?id=' + row.id,
+ data: _this.achieveItems,
+ contentType: 'application/json',
+ url: basePath + '/admin/achieve/add',
callback: function (data) {
+ _this.$message.success(data.info);
}
});
}
+ },
+
+ shareAchieve(index, row) {
+ var row2 = JSON.parse(JSON.stringify(row));
+ row2.id = null;
+ row2.isShare = true;
+ this.achieveItems.splice(index+1,0,row2);
+ this.calculationAchieve();
+ },
+ //业绩均分订单金额
+ calculationAchieve(){
+ console.log("计算业绩");
+ let jsqMap={};
+ this.achieveItems.forEach(achieve=>{
+ key=achieve.achieveType+achieve.orderItemId;
+ if(!jsqMap[key]){
+ jsqMap[key]=1;
+ }else{
+ jsqMap[key]++;
+ }
+ });
+ this.achieveItems.forEach(achieve=>{
+ key=achieve.achieveType+achieve.orderItemId;
+ achieve.goodsCash=(achieve.zkTotal/jsqMap[key]).toFixed(2);
+ });
+ },
+ //校验业绩是否大于订单收款金额
+ checkAchieveMoney(){
+ console.log("校验业绩是否大于订单收款金额");
+ let jsqMap={};
+ let isOk=true;
+ for(let i=0 ; i< this.achieveItems.length; i++){
+ let achieve=this.achieveItems[i];
+ if(!isNaN(achieve.goodsCash) ){
+ key=achieve.achieveType+achieve.orderItemId;
+ if(!jsqMap[key]){
+ jsqMap[key]=parseFloat(achieve.goodsCash);
+ }else{
+ jsqMap[key]=jsqMap[key]+parseFloat(achieve.goodsCash);
+ }
+ if(jsqMap[key]>achieve.zkTotal) {
+ this.$message.error("【"+achieve.goodsName + "】业绩分配金额大于支付金额");
+ isOk = false;
+ break;
+ }
+ }else{
+ this.$message.error("【"+achieve.goodsName + "】业绩分配金额请填写数字");
+ isOk=false;
+ break;
+ }
+ }
+ console.log("isOk",isOk);
+ return isOk;
+ },
+ //删除业绩
+ delAchieve(index, row) {
+ let _this = this;
_this.achieveItems.splice(index, 1);
+ this.calculationAchieve();
},
checkAchieveIsDel(items) {
var achieveIds = [];
@@ -874,7 +993,7 @@
var id = this.order.id;
layer.open({
type: 2,
- title: "打印服务单",
+ title: "打印订单",
area: ['250px', '550px'],
maxmin: true,
content: [basePath + '/admin/redirect/hive/beautySalon/print-order?id=' + id]
--
Gitblit v1.9.1