提交
This commit is contained in:
@@ -46,7 +46,7 @@
|
||||
v-for="(v, i) in goodsDataList"
|
||||
>
|
||||
<span
|
||||
v-if="v.isVipPrice == 1 && v.vipPrice != 0 && v.vipPrice != null&&!options.isFudu"
|
||||
v-if="v.isVipPrice == 1 && v.vipPrice != 0 && v.vipPrice != null"
|
||||
style="
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
@@ -88,7 +88,7 @@
|
||||
<view>
|
||||
<text
|
||||
v-if="
|
||||
v.isVipPrice == 1 && v.vipPrice != 0 && v.vipPrice != null&&!options.isFudu
|
||||
v.isVipPrice == 1 && v.vipPrice != 0 && v.vipPrice != null
|
||||
"
|
||||
>
|
||||
<text style="color: #e97512; font-size: 12px; font-weight: bold"
|
||||
@@ -109,7 +109,7 @@
|
||||
>
|
||||
</text>
|
||||
|
||||
<text v-else-if="v.activityPrice && v.activityPrice > 0&&!options.isFudu">
|
||||
<text v-else-if="v.activityPrice && v.activityPrice > 0">
|
||||
<text style="color: #e97512; font-size: 12px; font-weight: bold"
|
||||
>¥{{ v.activityPrice.toFixed(2) }}</text
|
||||
>
|
||||
@@ -319,6 +319,7 @@
|
||||
@input="handleChangejf"
|
||||
@clear="jfNumber = 0"
|
||||
:max="jfNumberMax"
|
||||
:min="0"
|
||||
v-model="jfNumber"
|
||||
placeholder="请输入积分"
|
||||
border="surround"
|
||||
@@ -555,16 +556,23 @@ export default {
|
||||
isDefaultCurrency: {
|
||||
immediate: true,
|
||||
handler(newRoute) {
|
||||
console.log(
|
||||
"this.isDefaultCurrency at line 482:",
|
||||
this.isDefaultCurrency
|
||||
);
|
||||
if (this.isDefaultCurrency) {
|
||||
if (platform == "ios") {
|
||||
this.selectPayIndex = 0;
|
||||
} else {
|
||||
this.selectPayIndex = 0;
|
||||
}
|
||||
|
||||
if (this.actualPayment == 0) {
|
||||
var that = this;
|
||||
this.payList.forEach((e, i) => {
|
||||
if (e.type == 4) {
|
||||
that.selectPayIndex = i;
|
||||
that.payType = 4;
|
||||
}
|
||||
});
|
||||
this.$forceUpdate();
|
||||
}
|
||||
} else {
|
||||
if (platform == "ios") {
|
||||
this.selectPayIndex = 0;
|
||||
@@ -795,80 +803,67 @@ export default {
|
||||
...mapState(["userInfo"]),
|
||||
},
|
||||
methods: {
|
||||
getGoodsList() {
|
||||
//判断复读逻辑
|
||||
if(this.options.isFudu){
|
||||
this.$http
|
||||
.request({
|
||||
url: "/common/courseRelearn/relearnShopProductList",
|
||||
method: "POST",
|
||||
data: {
|
||||
catalogueId: this.options.fuduId
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
this.goodsDataList =res.productList.filter((e)=>this.options.goods[0].productName == e.productName);
|
||||
// await this.getVipFei();
|
||||
// await this.getDistrictAmount();
|
||||
await this.getActiveCouponList();
|
||||
var list = [...this.goodsDataList];
|
||||
list = list.map((e) => e.goodsType);
|
||||
this.haveCourse = list.some((ele) => ele === "05");
|
||||
|
||||
if (this.options.sourceType == "curriculum") {
|
||||
this.goToInfo = {
|
||||
url: "/pages/curriculum/order/index/index",
|
||||
type: 2,
|
||||
};
|
||||
} else {
|
||||
this.goToInfo = {
|
||||
url: "/pages/bookShop/orderList",
|
||||
type: 1,
|
||||
};
|
||||
}
|
||||
this.initPrepareOrder();
|
||||
});
|
||||
}else{
|
||||
this.$http
|
||||
.request({
|
||||
url: "/book/buyOrder/getShopProductListByIds",
|
||||
method: "POST",
|
||||
data: {
|
||||
productIds: this.options.goods.map((e) => e.productId).toString(),
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
this.goodsDataList = res.shopProductList;
|
||||
console.log("this.goodsDataList at line 780:", this.goodsDataList);
|
||||
await this.getVipFei();
|
||||
await this.getDistrictAmount();
|
||||
await this.getActiveCouponList();
|
||||
var list = [...this.goodsDataList];
|
||||
list = list.map((e) => e.goodsType);
|
||||
this.haveCourse = list.some((ele) => ele === "05");
|
||||
|
||||
if (this.options.sourceType == "curriculum") {
|
||||
this.goToInfo = {
|
||||
url: "/pages/curriculum/order/index/index",
|
||||
type: 2,
|
||||
};
|
||||
} else {
|
||||
this.goToInfo = {
|
||||
url: "/pages/bookShop/orderList",
|
||||
type: 1,
|
||||
};
|
||||
}
|
||||
this.initPrepareOrder();
|
||||
});
|
||||
}
|
||||
async getGoodsDataInfo(fn) {
|
||||
if (this.options.isFudu) {
|
||||
await this.$http
|
||||
.request({
|
||||
url: "/common/courseRelearn/relearnShopProductList",
|
||||
method: "POST",
|
||||
data: {
|
||||
catalogueId: this.options.fuduId,
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
this.goodsDataList = res.productList.filter(
|
||||
(e) => this.options.goods[0].productName == e.productName
|
||||
);
|
||||
fn && fn();
|
||||
});
|
||||
} else {
|
||||
await this.$http
|
||||
.request({
|
||||
url: "/book/buyOrder/getShopProductListByIds",
|
||||
method: "POST",
|
||||
data: {
|
||||
productIds: this.options.goods.map((e) => e.productId).toString(),
|
||||
},
|
||||
header: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async (res) => {
|
||||
this.goodsDataList = res.shopProductList;
|
||||
fn && fn();
|
||||
});
|
||||
}
|
||||
},
|
||||
async getVipFei() {
|
||||
async getGoodsList() {
|
||||
//获取商品信息
|
||||
await this.getGoodsDataInfo();
|
||||
await this.initPrepareOrder();
|
||||
|
||||
await this.getVipFei();
|
||||
await this.getDistrictAmount();
|
||||
await this.getActiveCouponList();
|
||||
var list = [...this.goodsDataList];
|
||||
list = list.map((e) => e.goodsType);
|
||||
this.haveCourse = list.some((ele) => ele === "05");
|
||||
if (this.options.sourceType == "curriculum") {
|
||||
this.goToInfo = {
|
||||
url: "/pages/curriculum/order/index/index",
|
||||
type: 2,
|
||||
};
|
||||
} else {
|
||||
this.goToInfo = {
|
||||
url: "/pages/bookShop/orderList",
|
||||
type: 1,
|
||||
};
|
||||
}
|
||||
},
|
||||
async getVipFei() {
|
||||
let key = [];
|
||||
let dataToString = "";
|
||||
this.goodsDataList.forEach((item, index) => {
|
||||
@@ -878,7 +873,7 @@ export default {
|
||||
});
|
||||
});
|
||||
|
||||
await $http
|
||||
await $http
|
||||
.request({
|
||||
url: "/book/buyOrder/getVipDiscountAmount",
|
||||
method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档
|
||||
@@ -889,15 +884,15 @@ export default {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async(res) => {
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
console.log("res.code at line 538:", res);
|
||||
this.vipPrice = res.discountAmount;
|
||||
await this.getTotalPrice();
|
||||
await this.getTotalPrice();
|
||||
}
|
||||
});
|
||||
},
|
||||
async getDistrictAmount() {
|
||||
async getDistrictAmount() {
|
||||
let key = [];
|
||||
let dataToString = "";
|
||||
|
||||
@@ -910,7 +905,7 @@ export default {
|
||||
});
|
||||
console.log(key, "this.adressMoRen.areaidpath");
|
||||
|
||||
await $http
|
||||
await $http
|
||||
.request({
|
||||
// url: "book/buyOrder/calculateTransportPrice/",
|
||||
url: "/book/buyOrder/getDistrictAmount",
|
||||
@@ -924,12 +919,12 @@ export default {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then(async(res) => {
|
||||
.then(async (res) => {
|
||||
if (res.code == 0) {
|
||||
console.log("res.code at line 538111111111111111:", res);
|
||||
this.districtAmount = res.districtAmount;
|
||||
// console.log('需要的运费', res.result)
|
||||
await this.getTotalPrice();
|
||||
await this.getTotalPrice();
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -1030,19 +1025,36 @@ export default {
|
||||
handleChangejf(val) {
|
||||
var value = val;
|
||||
this.$nextTick(() => {
|
||||
// 1. 只允许数字字符,并去掉小数点后的部分
|
||||
value = value.replace(/[^0-9.]/g, ""); // 删除非数字和小数点字符
|
||||
|
||||
// 2. 如果有小数点,只保留小数点前的部分
|
||||
if (value.indexOf(".") !== -1) {
|
||||
value = value.split(".")[0]; // 截取小数点前的部分
|
||||
}
|
||||
|
||||
// 如果输入为0,强制设置为0并显示为 "0"
|
||||
if (val == 0) {
|
||||
this.jfNumber = 0;
|
||||
this.jfNumberShow = "0.00";
|
||||
this.jfNumberShow = "0";
|
||||
} else {
|
||||
if (value >= this.jfNumberMax) {
|
||||
value = this.jfNumberMax;
|
||||
|
||||
this.$forceUpdate();
|
||||
} else {
|
||||
// 3. 强制转换为正整数
|
||||
let numericValue = parseInt(value, 10); // 使用parseInt转换为整数
|
||||
if (numericValue < 0 || isNaN(numericValue)) {
|
||||
numericValue = 0;
|
||||
}
|
||||
this.jfNumber = Number(value);
|
||||
this.jfNumberShow = this.jfNumber.toFixed(2);
|
||||
|
||||
// 4. 确保最大值限制
|
||||
if (numericValue >= this.jfNumberMax) {
|
||||
numericValue = this.jfNumberMax;
|
||||
}
|
||||
|
||||
// 更新最终的数字值和显示
|
||||
this.jfNumber = Math.max(0, numericValue); // 强制为正整数
|
||||
this.jfNumberShow = this.jfNumber.toString(); // 显示整数
|
||||
}
|
||||
|
||||
// 计算实际支付金额
|
||||
var couponAmount = 0;
|
||||
if (this.curCouponId && this.curCoupon.couponEntity.id) {
|
||||
couponAmount = this.curCoupon.couponEntity.couponAmount;
|
||||
@@ -1055,8 +1067,18 @@ export default {
|
||||
this.districtAmount -
|
||||
this.vipPrice;
|
||||
|
||||
// 如果实际支付金额为0,设置支付方式为默认货币
|
||||
if (this.actualPayment == 0) {
|
||||
console.log("this.actualPayment at line 1097:", this.actualPayment);
|
||||
this.isDefaultCurrency = true;
|
||||
var that = this;
|
||||
this.payList.forEach((e, i) => {
|
||||
if (e.type == 4) {
|
||||
that.selectPayIndex = i;
|
||||
that.payType = 4;
|
||||
}
|
||||
});
|
||||
this.$forceUpdate();
|
||||
} else {
|
||||
this.isDefaultCurrency = false;
|
||||
}
|
||||
@@ -1116,7 +1138,7 @@ export default {
|
||||
}
|
||||
if (
|
||||
this.goodsDataList[0].activityPrice &&
|
||||
this.goodsDataList[0].activityPrice > 0 &&!this.options.isFudu
|
||||
this.goodsDataList[0].activityPrice > 0
|
||||
) {
|
||||
this.priceBreakdownList.push({
|
||||
text: "活动立减",
|
||||
@@ -1127,7 +1149,7 @@ export default {
|
||||
if (
|
||||
this.goodsDataList[0].isVipPrice &&
|
||||
this.goodsDataList[0].vipPrice &&
|
||||
this.goodsDataList[0].vipPrice > 0 &&!this.options.isFudu
|
||||
this.goodsDataList[0].vipPrice > 0
|
||||
) {
|
||||
this.priceBreakdownList.push({
|
||||
text: "VIP专享立减",
|
||||
@@ -1158,7 +1180,7 @@ export default {
|
||||
})
|
||||
|
||||
.then(async (res) => {
|
||||
console.log('res at line 1168:', res)
|
||||
console.log("res at line 1168:", res);
|
||||
if (res.code == 0) {
|
||||
this.initData = res.data;
|
||||
|
||||
@@ -1167,7 +1189,7 @@ export default {
|
||||
this.initData
|
||||
);
|
||||
this.isShowAddress = res.data.is_course ? false : true;
|
||||
if (!this.isShowAddress && !this.options.isFudu) {
|
||||
if (!this.isShowAddress) {
|
||||
this.priceBreakdownList.push({
|
||||
text: "积分",
|
||||
imgUrl: require("@/static/icon/jifen.png"),
|
||||
@@ -1294,24 +1316,27 @@ export default {
|
||||
couponAmount = 0;
|
||||
}
|
||||
if (!this.isShowAddress) {
|
||||
if(that.initData.user&&that.initData.user.jf){
|
||||
if (this.initData.user.jf >= that.totalPrice) {
|
||||
this.jfNumber = that.totalPrice - couponAmount;
|
||||
this.jfNumberMax = that.totalPrice - couponAmount;
|
||||
console.log("this.jfNumberMax at line 1303:", this.jfNumberMax);
|
||||
} else {
|
||||
if (this.initData.user.jf >= couponAmount) {
|
||||
this.jfNumber = this.initData.user.jf - couponAmount;
|
||||
this.jfNumberMax = this.initData.user.jf - couponAmount;
|
||||
if (that.initData.user && that.initData.user.jf) {
|
||||
var totalMoney =
|
||||
that.totalPrice - that.districtAmount - that.vipPrice;
|
||||
if (this.initData.user.jf >= totalMoney) {
|
||||
const integerPart = Math.floor(totalMoney);
|
||||
|
||||
this.jfNumber = integerPart - couponAmount; // 设置 jfNumber
|
||||
this.jfNumberMax = integerPart - couponAmount; // 设置 jfNumberMax
|
||||
} else {
|
||||
this.jfNumber = this.initData.user.jf;
|
||||
this.jfNumberMax = this.initData.user.jf;
|
||||
if (this.initData.user.jf >= couponAmount) {
|
||||
this.jfNumber = this.initData.user.jf - couponAmount;
|
||||
this.jfNumberMax = this.initData.user.jf - couponAmount;
|
||||
} else {
|
||||
this.jfNumber = this.initData.user.jf;
|
||||
this.jfNumberMax = this.initData.user.jf;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.jfNumber = 0;
|
||||
}
|
||||
}else{
|
||||
this.jfNumber=0
|
||||
}
|
||||
|
||||
|
||||
if (that.jfNumber == 0 || that.jfNumber == null) {
|
||||
that.jfNumberShow = "0.00";
|
||||
that.actualPayment = that.totalPrice - couponAmount;
|
||||
@@ -1382,13 +1407,8 @@ export default {
|
||||
let xiaBiao = [];
|
||||
let data = {};
|
||||
if (this.options.isFudu) {
|
||||
console.log(
|
||||
888888888,
|
||||
this.goodsDataList
|
||||
.map((e) => e.productId + "," + e.productName)
|
||||
.join(",")
|
||||
);
|
||||
data = {
|
||||
jfDeduction: this.jfNumber,
|
||||
paymentMethod: this.payType, //支付方式 2支付宝,1微信,3ios内购 4,天医币购买
|
||||
orderMoney: this.totalPrice, //订单金额
|
||||
realMoney: this.actualPayment, //实收金额
|
||||
@@ -1404,6 +1424,7 @@ export default {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
data = {
|
||||
buyType: this.options.typeId, //0- 商品页直接下单 1- 购物车结算
|
||||
userId: this.userInfo.id, //下单人ID
|
||||
|
||||
Reference in New Issue
Block a user