mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-03 02:36:39 +08:00
Merge branch 'sit-Carl' into sit-jiamin-v2
This commit is contained in:
commit
924738c8b6
@ -91,7 +91,6 @@ export const monitorOrderNotify = (OrderNumber) => {
|
|||||||
* 删除购物车
|
* 删除购物车
|
||||||
*/
|
*/
|
||||||
export const deleteCart = ( productCode) => {
|
export const deleteCart = ( productCode) => {
|
||||||
debugger;
|
|
||||||
var data = {
|
var data = {
|
||||||
productCode
|
productCode
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ picture {
|
|||||||
height: auto;
|
height: auto;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 40%;
|
top: 56vh;
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.16);
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.16);
|
||||||
border-radius: .25rem;
|
border-radius: .25rem;
|
||||||
|
@ -341,6 +341,7 @@ border-radius: 100px;
|
|||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
margin-top:1rem;
|
||||||
}
|
}
|
||||||
.ts-scrollable{
|
.ts-scrollable{
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
¥
|
¥
|
||||||
</i>
|
</i>
|
||||||
<span>
|
<span>
|
||||||
{{item.couponTypeId=='4'?parseInt(((item.discount)*10))+'折':item.couponAmount}}
|
{{ item.couponAmount?item.couponAmount:(parseInt((item.discount)*10)+'折') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
|
@ -426,7 +426,7 @@ ul li ol li em strong i {
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: self-end;
|
align-items: flex-end;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
i {
|
i {
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@ -440,7 +440,7 @@ ul li ol li em strong i {
|
|||||||
color: #e1001a;
|
color: #e1001a;
|
||||||
font-size: 26px;
|
font-size: 26px;
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
width:5rem;
|
min-width:6rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.discountInfo {
|
.discountInfo {
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
<div class="rc-userbottom">
|
<div class="rc-userbottom">
|
||||||
<p>¥{{ item.productPrice }}</p>
|
<p>¥{{ item.productPrice }}</p>
|
||||||
<p>X{{ item.buyCount }}</p>
|
<p>X{{ item.buyCount }}</p>
|
||||||
<p class="price">¥{{ item.productPrice }}</p>
|
<p class="price">¥{{ item.productPrice * item.buyCount }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -93,7 +93,7 @@
|
|||||||
<em>{{ discountAmount }}</em>
|
<em>{{ discountAmount }}</em>
|
||||||
</div>
|
</div>
|
||||||
<i>合计金额:</i>
|
<i>合计金额:</i>
|
||||||
<em>{{ discountedSumPrice }}</em>
|
<em>{{ finalAmount }}</em>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-weight: bold">
|
<div style="font-weight: bold">
|
||||||
<span @click="preJiesuan()">提交订单</span>
|
<span @click="preJiesuan()">提交订单</span>
|
||||||
@ -167,7 +167,7 @@
|
|||||||
¥
|
¥
|
||||||
</i>
|
</i>
|
||||||
<span>
|
<span>
|
||||||
{{item.couponTypeId=='4'?parseInt(((item.discount)*10))+'折':item.couponAmount}}
|
{{ item.couponAmount?item.couponAmount:(parseInt((item.discount)*10)+'折') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
@ -251,7 +251,9 @@ export default {
|
|||||||
promotion: "¥167.00",
|
promotion: "¥167.00",
|
||||||
payment: "¥0.00 ",
|
payment: "¥0.00 ",
|
||||||
},
|
},
|
||||||
discountAmount:0
|
discountAmount:0,
|
||||||
|
finalAmount:0,
|
||||||
|
discountedProductCode:undefined,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@ -261,12 +263,46 @@ export default {
|
|||||||
}, 0);
|
}, 0);
|
||||||
},
|
},
|
||||||
// 折扣计算
|
// 折扣计算
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapMutations(["checkIsLogin"]),
|
||||||
discountedSumPrice() {
|
discountedSumPrice() {
|
||||||
let total = 0;
|
let total = 0;
|
||||||
if(this.curCoupon.couponId) {
|
if(this.curCoupon.productCodes)
|
||||||
//Coupon Calculation
|
this.finalAmount = this.qualifiedProductDiscount();
|
||||||
|
else
|
||||||
|
this.finalAmount = this.wholeOrderDiscount();
|
||||||
|
this.finalAmount = parseFloat(this.finalAmount).toFixed(2);
|
||||||
|
this.discountAmount = parseFloat(this.discountAmount).toFixed(2);
|
||||||
|
},
|
||||||
|
wholeOrderDiscount(){
|
||||||
|
this.discountedItemIndex = 0;
|
||||||
|
let checkResult = true;
|
||||||
|
if(this.curCoupon.minPrice && this.curCoupon.minPrice > this.sumPrice) {
|
||||||
|
checkResult = false;
|
||||||
|
}
|
||||||
|
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount > this.sumPrice) {
|
||||||
|
checkResult = false;
|
||||||
|
}
|
||||||
|
if(checkResult) {
|
||||||
|
if(this.curCoupon.couponAmount && this.curCoupon.couponAmount>0) {
|
||||||
|
this.discountAmount = this.curCoupon.couponAmount;
|
||||||
|
return this.sumPrice - this.curCoupon.couponAmount;
|
||||||
|
} else if(this.curCoupon.discount && this.curCoupon.discount>0) {
|
||||||
|
this.discountAmount = this.sumPrice*this.curCoupon.discount;
|
||||||
|
return this.sumPrice * (1-this.curCoupon.discount);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return this.sumPrice;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
qualifiedProductDiscount(){
|
||||||
|
this.discountedItemIndex = 0;
|
||||||
|
let total = 0;
|
||||||
let couponUsed = false;
|
let couponUsed = false;
|
||||||
for(let itemInCart of this.goldmedal) {
|
let tmpShoppingCartList = this.arrSort(this.goldmedal);
|
||||||
|
|
||||||
|
for(let itemInCart of tmpShoppingCartList) {
|
||||||
if((!this.curCoupon.productCodes || this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) && !couponUsed) {
|
if((!this.curCoupon.productCodes || this.curCoupon.productCodes.indexOf(itemInCart.productCode)>-1) && !couponUsed) {
|
||||||
if(this.curCoupon.minQuantity && this.curCoupon.minQuantity>itemInCart.buyCount) {
|
if(this.curCoupon.minQuantity && this.curCoupon.minQuantity>itemInCart.buyCount) {
|
||||||
//Check minQuantity
|
//Check minQuantity
|
||||||
@ -280,18 +316,21 @@ export default {
|
|||||||
case 1: //Amount deduct
|
case 1: //Amount deduct
|
||||||
total = total + (itemInCart.productPrice * itemInCart.buyCount - this.curCoupon.couponAmount);
|
total = total + (itemInCart.productPrice * itemInCart.buyCount - this.curCoupon.couponAmount);
|
||||||
this.discountAmount = this.curCoupon.couponAmount;
|
this.discountAmount = this.curCoupon.couponAmount;
|
||||||
|
this.discountedProductCode = itemInCart.productCode;
|
||||||
couponUsed=true;
|
couponUsed=true;
|
||||||
break;
|
break;
|
||||||
case 2: //Amount deduct with minPrice restriction
|
case 2: //Amount deduct with minPrice restriction
|
||||||
case 6:
|
case 6:
|
||||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) - this.curCoupon.couponAmount;
|
total = total + (itemInCart.productPrice * itemInCart.buyCount) - this.curCoupon.couponAmount;
|
||||||
this.discountAmount = this.curCoupon.couponAmount;
|
this.discountAmount = this.curCoupon.couponAmount;
|
||||||
|
this.discountedProductCode = itemInCart.productCode;
|
||||||
couponUsed=true;
|
couponUsed=true;
|
||||||
break;
|
break;
|
||||||
case 3: //Limited product % discount
|
case 3: //Limited product % discount
|
||||||
case 4: //% discount
|
case 4: //% discount
|
||||||
total = total + (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
total = total + (itemInCart.productPrice * itemInCart.buyCount) * this.curCoupon.discount;
|
||||||
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount);
|
this.discountAmount = (itemInCart.productPrice * itemInCart.buyCount) * ( 1 - this.curCoupon.discount);
|
||||||
|
this.discountedProductCode = itemInCart.productCode;
|
||||||
couponUsed=true;
|
couponUsed=true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -304,22 +343,21 @@ export default {
|
|||||||
total += itemInCart.productPrice * itemInCart.buyCount;
|
total += itemInCart.productPrice * itemInCart.buyCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
//Normal Calculation
|
|
||||||
total=this.goldmedal.reduce((pre, cur) => {
|
|
||||||
return pre + cur.buyCount * cur.productPrice;
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
if(this.discountAmount)
|
|
||||||
this.discountAmount = this.discountAmount.toFixed(2);
|
|
||||||
if(!total)
|
|
||||||
total=0;
|
|
||||||
total = total.toFixed(2);
|
|
||||||
return total;
|
return total;
|
||||||
},
|
},
|
||||||
|
arrSort(arr) {
|
||||||
|
let userarr=[]
|
||||||
|
let a=[];
|
||||||
|
for(let i in arr){
|
||||||
|
arr[i].total=arr[i].productPrice*arr[i].buyCount;
|
||||||
|
if(arr[i].total){
|
||||||
|
userarr.push(arr[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return userarr.sort((n1,n2)=>{
|
||||||
|
return n2.total-n1.total;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
|
||||||
...mapMutations(["checkIsLogin"]),
|
|
||||||
async getAddressList() {
|
async getAddressList() {
|
||||||
let memberId = JSON.parse(localStorage.getItem("userInfo")).data.id;
|
let memberId = JSON.parse(localStorage.getItem("userInfo")).data.id;
|
||||||
let { data } = await memberAddress("getAll", { memberId: memberId });
|
let { data } = await memberAddress("getAll", { memberId: memberId });
|
||||||
@ -351,9 +389,11 @@ export default {
|
|||||||
let valDateFromTime=0;
|
let valDateFromTime=0;
|
||||||
let valDateToTime=0;
|
let valDateToTime=0;
|
||||||
let dateChecked=true;
|
let dateChecked=true;
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
this.drawlist=[];
|
this.drawlist=[];
|
||||||
for(let itemInCart of this.goldmedal) {
|
for(let itemInCart of this.goldmedal) {
|
||||||
|
let tmpIndex=0;
|
||||||
for(let myCoupon of data.data) {
|
for(let myCoupon of data.data) {
|
||||||
valDateFromTime=0;
|
valDateFromTime=0;
|
||||||
valDateToTime=0;
|
valDateToTime=0;
|
||||||
@ -370,9 +410,18 @@ export default {
|
|||||||
if(valDateToTime && curTime > valDateToTime) {
|
if(valDateToTime && curTime > valDateToTime) {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
if(dateChecked && myCoupon.status == 0 && (myCoupon.productCodes.indexOf(itemInCart.productCode)>-1 || !myCoupon.productCodes)) {
|
if(myCoupon.minQuantity && myCoupon.minQuantity>itemInCart.buyCount) {
|
||||||
|
dateChecked=false;
|
||||||
|
}
|
||||||
|
if(myCoupon.minPrice && myCoupon.minPrice>this.sumPrice) {
|
||||||
|
dateChecked=false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dateChecked && myCoupon.activityId != 10 && myCoupon.status == 0 && (!myCoupon.productCodes || myCoupon.productCodes.indexOf(itemInCart.productCode)>-1)) {
|
||||||
|
data.data.splice(tmpIndex,1);
|
||||||
_self.drawlist.push(myCoupon);
|
_self.drawlist.push(myCoupon);
|
||||||
}
|
}
|
||||||
|
tmpIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -380,6 +429,7 @@ export default {
|
|||||||
pickCoupon(item){
|
pickCoupon(item){
|
||||||
this.curCoupon = item;
|
this.curCoupon = item;
|
||||||
this.dialogInfo1 = false;
|
this.dialogInfo1 = false;
|
||||||
|
this.discountedSumPrice();
|
||||||
},
|
},
|
||||||
editAddress(item) {
|
editAddress(item) {
|
||||||
this.dialogAddTitle = "修改收货地址";
|
this.dialogAddTitle = "修改收货地址";
|
||||||
@ -459,6 +509,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let postData = [];
|
let postData = [];
|
||||||
|
let tmpCounter=0;
|
||||||
this.goldmedal.forEach((item) => {
|
this.goldmedal.forEach((item) => {
|
||||||
let basePoint = (item.basePoint?item.basePoint:0);
|
let basePoint = (item.basePoint?item.basePoint:0);
|
||||||
let oneProduct = {
|
let oneProduct = {
|
||||||
@ -483,7 +534,7 @@ export default {
|
|||||||
addressDetailInfo: orderAddress[0].detailAddress,
|
addressDetailInfo: orderAddress[0].detailAddress,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
if(this.curCoupon.couponId) {
|
if(this.curCoupon.couponId && item.productCode == this.discountedProductCode) {
|
||||||
oneProduct.couponId = this.curCoupon.couponId;
|
oneProduct.couponId = this.curCoupon.couponId;
|
||||||
oneProduct.couponTypeId = this.curCoupon.couponTypeId;
|
oneProduct.couponTypeId = this.curCoupon.couponTypeId;
|
||||||
oneProduct.couponName = this.curCoupon.couponName;
|
oneProduct.couponName = this.curCoupon.couponName;
|
||||||
@ -491,6 +542,7 @@ export default {
|
|||||||
oneProduct.couponAmount = (this.curCoupon.couponAmount?this.curCoupon.couponAmount:this.curCoupon.discount);
|
oneProduct.couponAmount = (this.curCoupon.couponAmount?this.curCoupon.couponAmount:this.curCoupon.discount);
|
||||||
}
|
}
|
||||||
postData.push(oneProduct);
|
postData.push(oneProduct);
|
||||||
|
tmpCounter++;
|
||||||
});
|
});
|
||||||
// let postData = [
|
// let postData = [
|
||||||
// {
|
// {
|
||||||
@ -570,6 +622,7 @@ export default {
|
|||||||
this.goldmedal = JSON.parse(this.$route.query.list);
|
this.goldmedal = JSON.parse(this.$route.query.list);
|
||||||
this.getAddressList();
|
this.getAddressList();
|
||||||
this.checkIsLogin();
|
this.checkIsLogin();
|
||||||
|
this.finalAmount = this.sumPrice;
|
||||||
// this.addressstype = this.$route.query.stype;
|
// this.addressstype = this.$route.query.stype;
|
||||||
// this.orderNumber = this.$route.query.orderNumber;
|
// this.orderNumber = this.$route.query.orderNumber;
|
||||||
// this.canceldanhao(this.orderNumber);
|
// this.canceldanhao(this.orderNumber);
|
||||||
|
@ -64,7 +64,9 @@
|
|||||||
<p>您的商品我们正在抓紧打包,请耐心等候!</p>
|
<p>您的商品我们正在抓紧打包,请耐心等候!</p>
|
||||||
<div class="line_dashed"></div>
|
<div class="line_dashed"></div>
|
||||||
<div class="userer">
|
<div class="userer">
|
||||||
<div class="qrcode"><vue-qr :text="qrtext" :size="260"></vue-qr></div>
|
<div class="qrcode">
|
||||||
|
<img src="/images/qrcode-aichong.jpg">
|
||||||
|
</div>
|
||||||
<p>微信扫一扫,识别二维码</p>
|
<p>微信扫一扫,识别二维码</p>
|
||||||
<p class="tips">加入社群0元试用商品随单发放</p>
|
<p class="tips">加入社群0元试用商品随单发放</p>
|
||||||
</div>
|
</div>
|
||||||
@ -94,7 +96,7 @@ export default {
|
|||||||
activeIndex: 0,
|
activeIndex: 0,
|
||||||
paymentTimer:undefined,
|
paymentTimer:undefined,
|
||||||
isSucess: false,
|
isSucess: false,
|
||||||
dialogSuccess: false,
|
dialogSuccess: true,
|
||||||
paytype: "微信",
|
paytype: "微信",
|
||||||
userpaystype: [
|
userpaystype: [
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<Myheader></Myheader>
|
<Myheader></Myheader>
|
||||||
<div class="rc-top"></div>
|
<div class="rc-top"></div>
|
||||||
<tabs :crumbs="crumbs"></tabs>
|
<tabs :crumbs="crumbs"></tabs>
|
||||||
<div class="online" id="fixed-catbar-seperator rc-margin--none"></div>
|
<div class="online rc-margin--none" id="fixed-catbar-seperator"></div>
|
||||||
<div class="rc-top"></div>
|
<div class="rc-top"></div>
|
||||||
<div
|
<div
|
||||||
class="
|
class="
|
||||||
@ -187,7 +187,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<span
|
<span
|
||||||
><i class="ts-row-title">商品编号:</i
|
><i class="ts-row-title">商品编号:</i
|
||||||
><i>{{ curItem.brandCode }}</i></span
|
><i>{{ curItem.productCode }}</i></span
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -224,7 +224,7 @@
|
|||||||
¥
|
¥
|
||||||
</i>
|
</i>
|
||||||
<span>
|
<span>
|
||||||
{{item.couponTypeId=='4'?parseInt(((item.discount)*10))+'折':item.couponAmount}}
|
{{ item.couponAmount?item.couponAmount:(parseInt((item.discount)*10)+'折') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<strong>{{ item.couponName }}</strong>
|
<strong>{{ item.couponName }}</strong>
|
||||||
@ -551,13 +551,13 @@ export default {
|
|||||||
if(valDateToTime && curTime > valDateToTime) {
|
if(valDateToTime && curTime > valDateToTime) {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
if(dateChecked) {
|
if(dateChecked && item.activityId!=10) {
|
||||||
if(!item.productCodes) {
|
if(!item.productCodes) {
|
||||||
menualist.push(item);
|
menualist.push(item);
|
||||||
} else {
|
} else {
|
||||||
item.productCodes = item.productCodes.split(",");
|
item.productCodes = item.productCodes.split(",");
|
||||||
item.productCodes.forEach((element) => {
|
item.productCodes.forEach((element) => {
|
||||||
if (element == this.curItem.productCode && item.activityId !== 10) {
|
if (element == this.curItem.productCode) {
|
||||||
menualist.push(item);
|
menualist.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -593,6 +593,8 @@ export default {
|
|||||||
// let userid=JSON.parse(location.getItem('userInfo'));
|
// let userid=JSON.parse(location.getItem('userInfo'));
|
||||||
// let mobile=JSON.parse(location.getItem('userInfo'));
|
// let mobile=JSON.parse(location.getItem('userInfo'));
|
||||||
// console.log(userid,mobile);
|
// console.log(userid,mobile);
|
||||||
|
let basePoint = item.basePoint;
|
||||||
|
basePoint = basePoint?basePoint:0;
|
||||||
let data = await postCourseId(
|
let data = await postCourseId(
|
||||||
item.productCode,
|
item.productCode,
|
||||||
this.sales_num,
|
this.sales_num,
|
||||||
@ -603,7 +605,7 @@ export default {
|
|||||||
item.ecPrice,
|
item.ecPrice,
|
||||||
item.specifications,
|
item.specifications,
|
||||||
item.leftAllotment,
|
item.leftAllotment,
|
||||||
item.basePoint
|
basePoint
|
||||||
);
|
);
|
||||||
if (data) {
|
if (data) {
|
||||||
this.productlist = data;
|
this.productlist = data;
|
||||||
@ -655,7 +657,7 @@ export default {
|
|||||||
this.dialogInfo2 = true;
|
this.dialogInfo2 = true;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
this.userdraw(this.usermessage.data.mobile);
|
//this.userdraw(this.usermessage.data.mobile);
|
||||||
this.alldrawlist(this.usermessage.data.id);
|
this.alldrawlist(this.usermessage.data.id);
|
||||||
this.dialogInfo1 = true;
|
this.dialogInfo1 = true;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="rc-column">
|
<div class="rc-column">
|
||||||
<div class="rc-click" @click="selectproduce(item)">
|
<div class="rc-click" @click="selectproduce(item)">
|
||||||
<span>{{ item.categoryName }}</span>
|
<span>{{ item.name }}</span>
|
||||||
<i>{{ item.ecPrice?("¥"+item.ecPrice):'' }}</i>
|
<i>{{ item.ecPrice?("¥"+item.ecPrice):'' }}</i>
|
||||||
</div>
|
</div>
|
||||||
<strong
|
<strong
|
||||||
|
@ -44,6 +44,7 @@ public class ResponseDTO<T> {
|
|||||||
this.success = responseCodeConst.isSuccess();
|
this.success = responseCodeConst.isSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private ResponseDTO(ResponseCodeConst responseCodeConst) {
|
private ResponseDTO(ResponseCodeConst responseCodeConst) {
|
||||||
this.code = responseCodeConst.getCode();
|
this.code = responseCodeConst.getCode();
|
||||||
this.msg = responseCodeConst.getMsg();
|
this.msg = responseCodeConst.getMsg();
|
||||||
@ -64,6 +65,8 @@ public class ResponseDTO<T> {
|
|||||||
return new ResponseDTO(ResponseCodeConst.SUCCESS, data, msg);
|
return new ResponseDTO(ResponseCodeConst.SUCCESS, data, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static <T> ResponseDTO<T> succData(T data) {
|
public static <T> ResponseDTO<T> succData(T data) {
|
||||||
return new ResponseDTO(ResponseCodeConst.SUCCESS, data);
|
return new ResponseDTO(ResponseCodeConst.SUCCESS, data);
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ import net.lab1024.smartadmin.constant.SwaggerTagConst;
|
|||||||
import net.lab1024.smartadmin.module.system.alipay.AliPayService;
|
import net.lab1024.smartadmin.module.system.alipay.AliPayService;
|
||||||
import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
|
import net.lab1024.smartadmin.module.system.alipay.alipayModel.AliPayEntity;
|
||||||
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
|
import net.lab1024.smartadmin.module.system.alipay.conf.AlipayConfig;
|
||||||
|
import net.lab1024.smartadmin.module.system.royalcanin.CouponService;
|
||||||
|
import net.lab1024.smartadmin.module.system.royalcanin.coupon.CouponGetAllEntity;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.constant.OrderResponseCodeConst;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.constant.OrderResponseCodeConst;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderAddress;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
||||||
@ -51,10 +53,13 @@ public class OrderController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private CartService cartService;
|
private CartService cartService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CouponService couponService;
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "微信支付订单", notes = "生成订单")
|
@ApiOperation(value = "微信支付订单", notes = "生成订单")
|
||||||
@PostMapping("royalcanin/generateOrderWX")
|
@PostMapping("royalcanin/generateOrderWX")
|
||||||
public ResponseDTO<String> generateOrderWX(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
|
public ResponseDTO<Map<String, String>> generateOrderWX(@RequestBody List<OrdersEntity> ordersEntityList) throws Exception {
|
||||||
StringBuffer productId = new StringBuffer();
|
StringBuffer productId = new StringBuffer();
|
||||||
StringBuffer productName = new StringBuffer();
|
StringBuffer productName = new StringBuffer();
|
||||||
String memberId = "";
|
String memberId = "";
|
||||||
@ -76,10 +81,18 @@ public class OrderController {
|
|||||||
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
|
orderDatilListEntity.setEcPrice(ordersEntitys.getPayAmount());
|
||||||
orderDatilListJson.add(orderDatilListEntity);
|
orderDatilListJson.add(orderDatilListEntity);
|
||||||
if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
|
if(ordersEntitys.getCouponCode() != "" && ordersEntitys.getCouponCode() != null) {
|
||||||
ordersEntity.setCouponAmount(ordersEntitys.getCouponAmount());
|
CouponGetAllEntity couponGetAllEntity = new CouponGetAllEntity ();
|
||||||
ordersEntity.setCouponCode(ordersEntitys.getCouponCode());
|
couponGetAllEntity.setMemberId(ordersEntitys.getMemberId());
|
||||||
ordersEntity.setCouponName(ordersEntitys.getCouponName());
|
couponGetAllEntity.setCouponCode(ordersEntitys.getCouponCode());
|
||||||
ordersEntity.setCouponId(ordersEntitys.getCouponId());
|
String couponInfo = couponService.couponGetAll(couponGetAllEntity);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(couponInfo);
|
||||||
|
com.alibaba.fastjson.JSONArray jsonArray = JSONObject.parseArray(jsonObject.getString("data"));
|
||||||
|
JSONObject jsonObjectData = (JSONObject)jsonArray.get(0);
|
||||||
|
|
||||||
|
ordersEntity.setCouponAmount(jsonObjectData.getString("couponAmount") == null ?jsonObjectData.getString("discount"):jsonObjectData.getString("couponAmount"));
|
||||||
|
ordersEntity.setCouponCode(jsonObjectData.getString("couponCode"));
|
||||||
|
ordersEntity.setCouponName(jsonObjectData.getString("couponName"));
|
||||||
|
ordersEntity.setCouponId(jsonObjectData.getString("couponId"));
|
||||||
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
|
total_fee = total_fee + orderService.couponTotal(ordersEntitys.getCouponTypeId(),Double.parseDouble(ordersEntitys.getCouponAmount()),Double.parseDouble(ordersEntitys.getPayAmount()),ordersEntitys.getBuyCount());
|
||||||
}else{
|
}else{
|
||||||
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
|
total_fee = total_fee + Double.parseDouble(ordersEntitys.getPayAmount()) * ordersEntitys.getBuyCount() ;
|
||||||
@ -112,7 +125,10 @@ public class OrderController {
|
|||||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||||
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
||||||
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
wxPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||||
return ResponseDTO.succData(ordersEntity.getOrderNo(),wxpayService.generateQRCode(wxPayEntity));
|
Map<String, String> returnMap = new HashMap<>();
|
||||||
|
returnMap.put("orderNumber",ordersEntity.getOrderNo());
|
||||||
|
returnMap.put("orderAmount",ordersEntity.getOrderAmount());
|
||||||
|
return ResponseDTO.succData(returnMap,wxpayService.generateQRCode(wxPayEntity));
|
||||||
}
|
}
|
||||||
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
|
return ResponseDTO.wrap(OrderResponseCodeConst.GENERATE_ORDER_FAIL);
|
||||||
}
|
}
|
||||||
@ -171,7 +187,6 @@ public class OrderController {
|
|||||||
ordersEntity.setBuyCount(buyCount);
|
ordersEntity.setBuyCount(buyCount);
|
||||||
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
|
ordersEntity.setOrderNo(GenerateSequenceUtil.generateSequenceNo());
|
||||||
ordersEntity.setOrderStatus("0");
|
ordersEntity.setOrderStatus("0");
|
||||||
|
|
||||||
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
if(orderService.generateOrder(ordersEntity,orderDatilListJson) == 1){
|
||||||
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
wxPayEntity.setProduct_id(ordersEntity.getProductCode());
|
||||||
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
wxPayEntity.setTotal_fee(StringUtil.toString(total_fee));
|
||||||
@ -252,7 +267,7 @@ public class OrderController {
|
|||||||
AliPayEntity aliPayEntity = new AliPayEntity();
|
AliPayEntity aliPayEntity = new AliPayEntity();
|
||||||
ordersEntity.setPayType("2");
|
ordersEntity.setPayType("2");
|
||||||
ordersEntity.setOrderStatus("0");
|
ordersEntity.setOrderStatus("0");
|
||||||
if (orderService.updateOrder(ordersEntity) == 1) {
|
if (orderService.updateOrder(ordersEntity.getOrderNo()) == 1) {
|
||||||
aliPayEntity.setProduct_code(ordersEntity.getProductCode());
|
aliPayEntity.setProduct_code(ordersEntity.getProductCode());
|
||||||
aliPayEntity.setTotal_amount(ordersEntity.getOrderAmount());
|
aliPayEntity.setTotal_amount(ordersEntity.getOrderAmount());
|
||||||
aliPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
aliPayEntity.setOut_trade_no(ordersEntity.getOrderNo());
|
||||||
|
@ -22,4 +22,6 @@ public interface OrdersDao extends BaseMapper<OrderEntity> {
|
|||||||
|
|
||||||
Integer cancelOrder(String out_trade_no);
|
Integer cancelOrder(String out_trade_no);
|
||||||
|
|
||||||
|
int updateByOrderNumber (@Param("orderNumber")String orderNumber);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,6 @@ public class OrdersEntity {
|
|||||||
|
|
||||||
private OrderAddress orderAddress;
|
private OrderAddress orderAddress;
|
||||||
|
|
||||||
private Double basePoint;
|
private Double basePoint = 0.0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -281,7 +281,7 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int updateOrder(OrderEntity orderEntity){
|
public int updateOrder(String orderNumber){
|
||||||
return ordersDao.updateById(orderEntity);
|
return ordersDao.updateByOrderNumber(orderNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ import java.io.*;
|
|||||||
@Component
|
@Component
|
||||||
public class MyConfig implements WXPayConfig {
|
public class MyConfig implements WXPayConfig {
|
||||||
|
|
||||||
// private String path ="C:/Users/Administrator/IdeaProjects/smart-admin/smart-admin-service/smart-admin-api/src/main/resources/wxpay/";
|
// private String path ="C:/Users/Administrator/IdeaProjects/smart-admin/smart-admin-service/smart-admin-api/src/main/resources/wxpay/pro/";
|
||||||
private String path ="/home/royalcanin-dev/cert/";
|
private String path ="/home/royalcanin-dev/cert/pro/";
|
||||||
|
|
||||||
// public String notify_url = "http://47.96.75.242:10086/smart-admin-api/royalcanin/updateOrderWX";
|
// public String notify_url = "http://47.96.75.242:10086/smart-admin-api/royalcanin/updateOrderWX";
|
||||||
|
|
||||||
@ -34,18 +34,22 @@ public class MyConfig implements WXPayConfig {
|
|||||||
certStream.close();
|
certStream.close();
|
||||||
}
|
}
|
||||||
public String getAppID() {
|
public String getAppID() {
|
||||||
return "wx3c51c14272f63a64";
|
return "wxa9a0ae603bbe6ceb";
|
||||||
}
|
}
|
||||||
//wxa9a0ae603bbe6ceb
|
//wx3c51c14272f63a64
|
||||||
|
|
||||||
|
// public String getMchID() {
|
||||||
|
// return "16717629989";
|
||||||
|
// }
|
||||||
public String getMchID() {
|
public String getMchID() {
|
||||||
return "1315161001";
|
return "1523977801";
|
||||||
}
|
}
|
||||||
// 16717629989
|
//1315161001
|
||||||
|
|
||||||
public String getKey() {
|
public String getKey() {
|
||||||
return "b69497999e8fd1f8f1f0a9591b24eb72";
|
return "indexphpcorecertapicert201903200";
|
||||||
}
|
}
|
||||||
//indexphpcorecertapicert201903200
|
//b69497999e8fd1f8f1f0a9591b24eb72
|
||||||
|
|
||||||
public InputStream getCertStream() {
|
public InputStream getCertStream() {
|
||||||
ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
|
ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.lab1024.smartadmin.module.system.wxpay;
|
package net.lab1024.smartadmin.module.system.wxpay;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.aliyun.oss.internal.SignUtils;
|
||||||
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
import net.lab1024.smartadmin.common.heartbeat.StringUtil;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.MemberAccountService;
|
import net.lab1024.smartadmin.module.system.royalcanin.MemberAccountService;
|
||||||
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
import net.lab1024.smartadmin.module.system.royalcanin.good.model.OrderEntity;
|
||||||
|
@ -15,7 +15,7 @@ public class SmartJWTUtil {
|
|||||||
/**
|
/**
|
||||||
* 过期时间一天
|
* 过期时间一天
|
||||||
*/
|
*/
|
||||||
private static final int EXPIRE_SECONDS = 1 * 24 * 3600;
|
private static final int EXPIRE_SECONDS = 365 * 24 * 3600;
|
||||||
/**
|
/**
|
||||||
* jwt加密字段
|
* jwt加密字段
|
||||||
*/
|
*/
|
||||||
@ -78,7 +78,7 @@ public class SmartJWTUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String token = SmartJWTUtil.generateToken("884127");
|
String token = SmartJWTUtil.generateToken("884159");
|
||||||
System.out.println(token);
|
System.out.println(token);
|
||||||
System.out.println(SmartJWTUtil.decodeToken(token));
|
System.out.println(SmartJWTUtil.decodeToken(token));
|
||||||
}
|
}
|
||||||
|
@ -22,4 +22,10 @@
|
|||||||
|
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updateByOrderNumber" >
|
||||||
|
update t_good_orders
|
||||||
|
set pay_type ='2'
|
||||||
|
where order_no = #{orderNumber}
|
||||||
|
</update>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Binary file not shown.
@ -0,0 +1,23 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIID6TCCAtGgAwIBAgIUMO4qJG/XR9oQeHQphVQ7usz5/0YwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT
|
||||||
|
FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg
|
||||||
|
Q0EwHhcNMjIwMTI0MDgxMTA3WhcNMjcwMTIzMDgxMTA3WjB7MRMwEQYDVQQDDAox
|
||||||
|
NTIzOTc3ODAxMRswGQYDVQQKDBLlvq7kv6HllYbmiLfns7vnu58xJzAlBgNVBAsM
|
||||||
|
HuS4iua1t+aHi+avheWVhui0uOaciemZkOWFrOWPuDELMAkGA1UEBgwCQ04xETAP
|
||||||
|
BgNVBAcMCFNoZW5aaGVuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
|
||||||
|
yRnwfm/9lHyq16cAJjx8/7x9WQF+/mKry6MvJIquaXUXBQKDO3d4deBLq8By7dXD
|
||||||
|
xi7S7bPFeUkjXhgxs/WD15xyzNZj4qpKmXuEaFi0g1VLNUs3RmlWaR9OX0On+G2X
|
||||||
|
vj4Zw1bi7sbefA1UrgNB7CH6nAaIVVWDdggxnUeX18F1y7BUBjPBh64Trbi0n011
|
||||||
|
U/m738gyH37tfcSZCMM7aBO4/8BqRmRmNr58Owci8ee7G2yybGbRyVpT/3Y7cWLt
|
||||||
|
k4pyOavIjpmaIo/CPbwMC5hOR4fxwyZUaTpyZh7foQFytz05UHvxp35hKZLnxI2d
|
||||||
|
U+0wtymYYxTFGe6BngVHVwIDAQABo4GBMH8wCQYDVR0TBAIwADALBgNVHQ8EBAMC
|
||||||
|
BPAwZQYDVR0fBF4wXDBaoFigVoZUaHR0cDovL2V2Y2EuaXRydXMuY29tLmNuL3B1
|
||||||
|
YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUwREJDMDRCMDZBRDM5NzU0OTg0NkMw
|
||||||
|
MUMzRThFQkQyMA0GCSqGSIb3DQEBCwUAA4IBAQCOhr56rhhVqckEiN63f1JHD+SG
|
||||||
|
4DRLCkcJ5oon2EvKOxCKFW9sqcggjtoF3R5ZQe8TwpGl/Pp7t0tbcpor9Gpr3V75
|
||||||
|
fkkCsvotCaB3Hbpw/VzXP96848cQ8B/QtU+7oLCkCnakXeorgf/cLN/IlZ8ZAb5B
|
||||||
|
R7ZEf8qthobPqAygrk1ZLmRNKzEMD+kWaFvffkYGeGP1chZPqevb4sS0BlckBaP/
|
||||||
|
xeeU7R9Y5p5FANzIDCmHoFxqsrGLnF7Dh+bQSPSnG/rZjXnCYJFG6Jp/VvXP6enh
|
||||||
|
5fpVimiUe/62aP6XkKLSm1sX9b86GuTaAl58n78oocNa/XBcKNJNa/3A37bW
|
||||||
|
-----END CERTIFICATE-----
|
@ -0,0 +1,28 @@
|
|||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDJGfB+b/2UfKrX
|
||||||
|
pwAmPHz/vH1ZAX7+YqvLoy8kiq5pdRcFAoM7d3h14EurwHLt1cPGLtLts8V5SSNe
|
||||||
|
GDGz9YPXnHLM1mPiqkqZe4RoWLSDVUs1SzdGaVZpH05fQ6f4bZe+PhnDVuLuxt58
|
||||||
|
DVSuA0HsIfqcBohVVYN2CDGdR5fXwXXLsFQGM8GHrhOtuLSfTXVT+bvfyDIffu19
|
||||||
|
xJkIwztoE7j/wGpGZGY2vnw7ByLx57sbbLJsZtHJWlP/djtxYu2TinI5q8iOmZoi
|
||||||
|
j8I9vAwLmE5Hh/HDJlRpOnJmHt+hAXK3PTlQe/GnfmEpkufEjZ1T7TC3KZhjFMUZ
|
||||||
|
7oGeBUdXAgMBAAECggEBAKmjzA+cgRjlIWjRY3rdw8QnSMXwUSReL/WULoxwwDgN
|
||||||
|
oeGEARgE7ATjtHGp4klm7cMcdKo33/k0DTWuyx63mQQk4WKR56ipZkyauVMcoQm4
|
||||||
|
xbyrOnGXImGDGyWZePRD3qGI2UrC3KP39m5HAIvaC54Z+8HqcM8rV74Vo2S9pAVH
|
||||||
|
mhdH9VC5tnp2cBnOh8UyhIYmqAj/SXSk5Becq2IoYG8r5vojvohtxL/w5hbEfBnz
|
||||||
|
VhjZo82t0hhFGHfFJHw/3D2JjGdYI8QTxTZ78pMb0uK5XsJtxdQFKf5jS4XopJ5k
|
||||||
|
2h/YtAHxFv6K1cqyAaS3ZoyYGTOWy+eQrycGm62nNqECgYEA6UMsK8t/eS4NE1rK
|
||||||
|
capEufddSDzUr2C34ZLxZgXXOpLEdbvvADlCVqqT0/N682xxeM0iK+HVHRpmbzE9
|
||||||
|
v0MKPeMuRJ14aoiQEdGhDwEWgkyZr3GGdkgsIxO3/x9TNBK4F9pxZPFLSvkNDscO
|
||||||
|
75A2CBtB18gm6yAHkr+UQRlpXpsCgYEA3LQ4Tfme2xD6sa0WE+SFGk4hW/wfMawi
|
||||||
|
C1v5xJEjmI2ucKw3i19fKT+3a1LHY47ytjNS0hRQUoEYO0iEe1wO9t1TExmreLar
|
||||||
|
mUW4jcnoLEUBBYHfu6vTbyoRePUXhtk9jb2cFEMpDXI3qNwGN+2LTRz3Q1G8T+D9
|
||||||
|
kdHHGLF+h/UCgYB1GH5dAcvdBiwUMjh8NNBJVo7iS38tBu1n9H7wCzCPO8wZmh0R
|
||||||
|
TK0rmneZJ5nqBt8zmC52PujfsjgHy31GvR2wEZJRaYdgW2uPNl+Wi6JECLYBp4ir
|
||||||
|
afGWLjjofk4jTt5RQxw3YxW77igK6gxqYEdvbFdyPgyjbbG/jiKbR2lozwKBgQCU
|
||||||
|
PwXW8oYO1e/eqsm6oPP7AGIN/GMjpWDUynoR2//R99ElY7iHiI9OELtufpLpv9ou
|
||||||
|
InlOHVD6qjYRlBtRFTwD/BRSLxrroZ/P+3IE44ttOQh/n4Yd9EO4VsSXv+GGtaNP
|
||||||
|
8v3E6nvHyWGzrd8LcCbyrDM2Z8+axCDu8r7OSmMYhQKBgQDa3hTeI/sV72kH+8vz
|
||||||
|
GaTbQBtuxI34sKOxdsp7vR2IfTJjOPhTHgxCnISUaHFvgnYpmNgSZbLBMasIWouz
|
||||||
|
9NbU+lEwGBXKcNbCKQaWut7z3CArsV5j/9kKQrBwXWVsFNgKYwO0Md7aEKtcruLN
|
||||||
|
WjetT3R9CLwHFB2H+K3Mi0+5JA==
|
||||||
|
-----END PRIVATE KEY-----
|
Loading…
Reference in New Issue
Block a user