|
@@ -1,180 +1,204 @@
|
|
|
-// 商品详情
|
|
|
-var conMixins = function () {
|
|
|
- return {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- balance: {
|
|
|
- isFreight:false, //使用采美豆抵扣运费
|
|
|
- flag: false, //使用余额抵扣
|
|
|
- },
|
|
|
- hanldShouldPayFee:0,//
|
|
|
- userMoney: 0.0, // 显示可使用余额
|
|
|
- deductMoney: 0.0, // 显示已使用的余额
|
|
|
- urlType:0,
|
|
|
- radio:1,
|
|
|
- visible:false,
|
|
|
- reducedPrice: 0, // 满减金额
|
|
|
- couponAmount:0, // 优惠券金额
|
|
|
- handlePostage:0 //记录修改的运费
|
|
|
- }
|
|
|
- },
|
|
|
- computed: {
|
|
|
- // 计算订单最终支付金额 = 供应商下的合计金额之和
|
|
|
- orderTotalPrice(){
|
|
|
- let totalPrice = 0
|
|
|
- this.listData.forEach(el =>{
|
|
|
- totalPrice += el.totalPrice
|
|
|
- })
|
|
|
- console.log('订单最终金额',totalPrice)
|
|
|
- return totalPrice - this.couponAmount
|
|
|
- },
|
|
|
- // 显示勾选后的剩余抵 = 用户总余额-当前使用金额
|
|
|
- surplusMoney(){
|
|
|
- console.log('剩余余额', (this.userMoney - this.deductMoney))
|
|
|
- return this.userMoney - this.deductMoney
|
|
|
- },
|
|
|
- // 共减金额 = 减金额 + 优惠券金额
|
|
|
- totalDiscountAmount(){
|
|
|
- console.log('共减金额', (this.reducedPrice + this.couponAmount))
|
|
|
- return this.reducedPrice + this.couponAmount
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- //勾选使用余额
|
|
|
- checkedBalabce() {
|
|
|
- if (this.balance.flag) {// 是否勾选余额抵扣
|
|
|
- this.confirmParam.payInfo.balancePayFlag = 1
|
|
|
- this.attributePallPrice()
|
|
|
- }else{
|
|
|
- this.confirmParam.payInfo.balancePayFlag = 0
|
|
|
- this.attributePallPrice()
|
|
|
- }
|
|
|
- console.log('勾选使用余额最终订单支付金额', this.hanldShouldPayFee)
|
|
|
- },
|
|
|
- // 计算最终订单支付金额
|
|
|
- attributePallPrice() {
|
|
|
- if (this.balance.flag) {// 是否勾选余额抵扣
|
|
|
- if (this.userMoney >= this.orderTotalPrice) {
|
|
|
- this.hanldShouldPayFee =0.0
|
|
|
- this.deductMoney = this.orderTotalPrice// 当前使用金额等于订单金额
|
|
|
- console.log('最终订单支付金额00001', this.hanldShouldPayFee)
|
|
|
- } else {
|
|
|
- this.hanldShouldPayFee = this.orderTotalPrice - this.userMoney // 订单最终支付金额等于订单金额-账户余额
|
|
|
- this.deductMoney = this.userMoney // 当前使用金额等于总余额
|
|
|
- console.log('最终订单支付金额00002', this.hanldShouldPayFee)
|
|
|
- }
|
|
|
- console.log('余额抵扣最终订单支付金额', this.hanldShouldPayFee)
|
|
|
- } else {
|
|
|
- this.hanldShouldPayFee = this.orderTotalPrice
|
|
|
- this.deductMoney = 0 // 当前使用
|
|
|
- console.log('未余额抵扣最终订单支付金额', this.hanldShouldPayFee)
|
|
|
- }
|
|
|
- },
|
|
|
- //修改运费
|
|
|
- handlePostageFlag($event,supplier){ // 选择到付 总运费为到付 供应商总价格 - 总运费 确认订单总金额 - 总运费
|
|
|
- console.log('$event',$event)
|
|
|
- // const postage = supplier.isColdChina ? ( supplier.postage + supplier.coldChain ) : supplier.postage
|
|
|
- supplier.handlePostageFlag = $event;
|
|
|
- if(supplier.handlePostageFlag === 1){
|
|
|
- supplier.totalPrice = Number((supplier.totalPrice*100 + supplier.postage*100)/100)
|
|
|
- this.attributePallPrice()
|
|
|
- }else{
|
|
|
- supplier.totalPrice = Number(this.repiceNumSub(supplier.totalPrice,supplier.postage))
|
|
|
- this.attributePallPrice()
|
|
|
- }
|
|
|
- },
|
|
|
- // 勾选冷链费
|
|
|
- handleChangeColdChina(flag,supplier){
|
|
|
- if(flag){
|
|
|
- supplier.totalPrice = Number((supplier.totalPrice*100 + supplier.coldChain*100)/100)
|
|
|
- this.attributePallPrice()
|
|
|
- console.log('totalPrice',supplier.totalPrice)
|
|
|
- }else{
|
|
|
- supplier.totalPrice = Number(this.repiceNumSub(supplier.totalPrice,supplier.coldChain))
|
|
|
- this.attributePallPrice()
|
|
|
- console.log('hanldShouldPayFee',this.hanldShouldPayFee)
|
|
|
- }
|
|
|
- },
|
|
|
- // 计算总运费
|
|
|
- handleTotalPostage(supplier){
|
|
|
- if(supplier.isColdChina){
|
|
|
- if(supplier.handlePostageFlag === 2){
|
|
|
- return (supplier.coldChain*100 + supplier.postage*100 - supplier.postage*100)/100
|
|
|
- }else{
|
|
|
- return (supplier.postage*100 + supplier.coldChain*100)/100
|
|
|
- }
|
|
|
- }else{
|
|
|
- return supplier.postage
|
|
|
- }
|
|
|
- },
|
|
|
- // 购物车去结算确认订单初始化
|
|
|
- getCartCreateOrderInfo () {
|
|
|
- const _self = this;
|
|
|
- if(this.userId ===0){return;}
|
|
|
- OrderApi.GetOrderConfirmInfo(this.cartParam,function(response){
|
|
|
- if (response.code === 0 ) {
|
|
|
- _self.setCreatDataInfo(response.data)
|
|
|
- }else{
|
|
|
- CAIMEI.Alert(r.msg, '确定', false);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 商品立即购买确认订单初始化
|
|
|
- getProductCreateOrderInfo(){
|
|
|
- const _self = this;
|
|
|
- if(this.userId ===0){return;}
|
|
|
- OrderApi.ProductCreateOrderInfo(this.productParam,function(response){
|
|
|
- if (response.code === 0 ) {
|
|
|
- _self.setCreatDataInfo(response.data)
|
|
|
- }else{
|
|
|
- CAIMEI.Alert(response.msg, '确定', false);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 组合商品确认订单初始化
|
|
|
- OrderClubProductSupporting(){
|
|
|
- const _self = this;
|
|
|
- if(this.userId ===0){return;}
|
|
|
- OrderApi.OrderClubProductSupporting(this.supportParm,function(response){
|
|
|
- if (response.code === 0 ) {
|
|
|
- _self.setCreatDataInfo(response.data)
|
|
|
- }else{
|
|
|
- CAIMEI.Alert(r.msg, '确定', false);
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- setCreatDataInfo(data){
|
|
|
- this.listData = data.list.map((el)=>{
|
|
|
- el.handlePostageFlag = el.postageFlag
|
|
|
- return el
|
|
|
- });
|
|
|
- this.totalPrice = data.totalPrice;
|
|
|
- this.reducedPrice = data.reducedPrice;
|
|
|
- this.totalCount = data.totalCount;
|
|
|
- this.kindCount = data.kindCount;
|
|
|
- this.userMoney = data.userMoney;
|
|
|
- this.hanldShouldPayFee = data.totalPrice;
|
|
|
- this.svipReducedPrice = data.svipReducedPrice;
|
|
|
- this.returnGoodsStutas = data.returnGoodsStutas === 2 // 当前商品是否为特殊商品 1不是 2是
|
|
|
- this.helpContent = data.helpContent
|
|
|
- if( data.couponList && data.couponList.length>0){
|
|
|
- this.isCouponShow = true;
|
|
|
- this.couponAmount = data.couponList[0].couponAmount;
|
|
|
- this.confirmParam.clubCouponId = data.couponList[0].clubCouponId;
|
|
|
- this.couponList = data.couponList.map((el) =>{
|
|
|
- return { ...el,...{ischecked:false}}
|
|
|
- })
|
|
|
- this.couponList[0].ischecked = true;
|
|
|
- this.hanldShouldPayFee = data.totalPrice - this.couponAmount;
|
|
|
- }
|
|
|
- this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
|
|
|
- if(data.invoice){
|
|
|
- data.invoice.type = 0;
|
|
|
- this.orderInvoice = { ...this.orderInvoice , ...data.invoice } ;
|
|
|
- this.orderInvoice.headingType = 0
|
|
|
- }
|
|
|
- },
|
|
|
- }
|
|
|
- }
|
|
|
-}();
|
|
|
-
|
|
|
+// 商品详情
|
|
|
+var conMixins = function () {
|
|
|
+ return {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ balance: {
|
|
|
+ isFreight:false, //使用采美豆抵扣运费
|
|
|
+ flag: false, //使用余额抵扣
|
|
|
+ },
|
|
|
+ hanldShouldPayFee:0,//
|
|
|
+ userMoney: 0.0, // 显示可使用余额
|
|
|
+ deductMoney: 0.0, // 显示已使用的余额
|
|
|
+ isContract: false, // 显示销售合同
|
|
|
+ checkedContractFlag: false, // 是否勾选合同
|
|
|
+ dialogVisible: false, // 控制销售合同显示
|
|
|
+ formattedDate: '',
|
|
|
+ clubInfo: {},
|
|
|
+ urlType:0,
|
|
|
+ radio:1,
|
|
|
+ visible:false,
|
|
|
+ reducedPrice: 0, // 满减金额
|
|
|
+ couponAmount:0, // 优惠券金额
|
|
|
+ handlePostage:0 //记录修改的运费
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ // 计算订单最终支付金额 = 供应商下的合计金额之和
|
|
|
+ orderTotalPrice(){
|
|
|
+ let totalPrice = 0
|
|
|
+ this.listData.forEach(el =>{
|
|
|
+ totalPrice += el.totalPrice
|
|
|
+ })
|
|
|
+ console.log('订单最终金额',totalPrice)
|
|
|
+ return totalPrice - this.couponAmount
|
|
|
+ },
|
|
|
+ // 显示勾选后的剩余抵 = 用户总余额-当前使用金额
|
|
|
+ surplusMoney(){
|
|
|
+ console.log('剩余余额', (this.userMoney - this.deductMoney))
|
|
|
+ return this.userMoney - this.deductMoney
|
|
|
+ },
|
|
|
+ // 共减金额 = 减金额 + 优惠券金额
|
|
|
+ totalDiscountAmount(){
|
|
|
+ console.log('共减金额', (this.reducedPrice + this.couponAmount))
|
|
|
+ return this.reducedPrice + this.couponAmount
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 查看合同
|
|
|
+ handleContract(){
|
|
|
+ this.dialogVisible = true
|
|
|
+ },
|
|
|
+ // 关闭
|
|
|
+ handleClose(){
|
|
|
+ this.dialogVisible = false
|
|
|
+ },
|
|
|
+ // 勾选合同
|
|
|
+ checkedContract(){
|
|
|
+ console.log('checkedContractFlag',this.checkedContractFlag)
|
|
|
+ },
|
|
|
+ //勾选使用余额
|
|
|
+ checkedBalabce() {
|
|
|
+ if (this.balance.flag) {// 是否勾选余额抵扣
|
|
|
+ this.confirmParam.payInfo.balancePayFlag = 1
|
|
|
+ this.attributePallPrice()
|
|
|
+ }else{
|
|
|
+ this.confirmParam.payInfo.balancePayFlag = 0
|
|
|
+ this.attributePallPrice()
|
|
|
+ }
|
|
|
+ console.log('勾选使用余额最终订单支付金额', this.hanldShouldPayFee)
|
|
|
+ },
|
|
|
+ // 计算最终订单支付金额
|
|
|
+ attributePallPrice() {
|
|
|
+ if (this.balance.flag) {// 是否勾选余额抵扣
|
|
|
+ if (this.userMoney >= this.orderTotalPrice) {
|
|
|
+ this.hanldShouldPayFee =0.0
|
|
|
+ this.deductMoney = this.orderTotalPrice// 当前使用金额等于订单金额
|
|
|
+ console.log('最终订单支付金额00001', this.hanldShouldPayFee)
|
|
|
+ } else {
|
|
|
+ this.hanldShouldPayFee = this.orderTotalPrice - this.userMoney // 订单最终支付金额等于订单金额-账户余额
|
|
|
+ this.deductMoney = this.userMoney // 当前使用金额等于总余额
|
|
|
+ console.log('最终订单支付金额00002', this.hanldShouldPayFee)
|
|
|
+ }
|
|
|
+ console.log('余额抵扣最终订单支付金额', this.hanldShouldPayFee)
|
|
|
+ } else {
|
|
|
+ this.hanldShouldPayFee = this.orderTotalPrice
|
|
|
+ this.deductMoney = 0 // 当前使用
|
|
|
+ console.log('未余额抵扣最终订单支付金额', this.hanldShouldPayFee)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //修改运费
|
|
|
+ handlePostageFlag($event,supplier){ // 选择到付 总运费为到付 供应商总价格 - 总运费 确认订单总金额 - 总运费
|
|
|
+ console.log('$event',$event)
|
|
|
+ // const postage = supplier.isColdChina ? ( supplier.postage + supplier.coldChain ) : supplier.postage
|
|
|
+ supplier.handlePostageFlag = $event;
|
|
|
+ if(supplier.handlePostageFlag === 1){
|
|
|
+ supplier.totalPrice = Number((supplier.totalPrice*100 + supplier.postage*100)/100)
|
|
|
+ this.attributePallPrice()
|
|
|
+ }else{
|
|
|
+ supplier.totalPrice = Number(this.repiceNumSub(supplier.totalPrice,supplier.postage))
|
|
|
+ this.attributePallPrice()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 勾选冷链费
|
|
|
+ handleChangeColdChina(flag,supplier){
|
|
|
+ if(flag){
|
|
|
+ supplier.totalPrice = Number((supplier.totalPrice*100 + supplier.coldChain*100)/100)
|
|
|
+ this.attributePallPrice()
|
|
|
+ console.log('totalPrice',supplier.totalPrice)
|
|
|
+ }else{
|
|
|
+ supplier.totalPrice = Number(this.repiceNumSub(supplier.totalPrice,supplier.coldChain))
|
|
|
+ this.attributePallPrice()
|
|
|
+ console.log('hanldShouldPayFee',this.hanldShouldPayFee)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 计算总运费
|
|
|
+ handleTotalPostage(supplier){
|
|
|
+ if(supplier.isColdChina){
|
|
|
+ if(supplier.handlePostageFlag === 2){
|
|
|
+ return (supplier.coldChain*100 + supplier.postage*100 - supplier.postage*100)/100
|
|
|
+ }else{
|
|
|
+ return (supplier.postage*100 + supplier.coldChain*100)/100
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return supplier.postage
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 购物车去结算确认订单初始化
|
|
|
+ getCartCreateOrderInfo () {
|
|
|
+ const _self = this;
|
|
|
+ if(this.userId ===0){return;}
|
|
|
+ OrderApi.GetOrderConfirmInfo(this.cartParam,function(response){
|
|
|
+ if (response.code === 0 ) {
|
|
|
+ _self.setCreatDataInfo(response.data)
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(r.msg, '确定', false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 商品立即购买确认订单初始化
|
|
|
+ getProductCreateOrderInfo(){
|
|
|
+ const _self = this;
|
|
|
+ if(this.userId ===0){return;}
|
|
|
+ OrderApi.ProductCreateOrderInfo(this.productParam,function(response){
|
|
|
+ if (response.code === 0 ) {
|
|
|
+ _self.setCreatDataInfo(response.data)
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(response.msg, '确定', false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 组合商品确认订单初始化
|
|
|
+ OrderClubProductSupporting(){
|
|
|
+ const _self = this;
|
|
|
+ if(this.userId ===0){return;}
|
|
|
+ OrderApi.OrderClubProductSupporting(this.supportParm,function(response){
|
|
|
+ if (response.code === 0 ) {
|
|
|
+ _self.setCreatDataInfo(response.data)
|
|
|
+ }else{
|
|
|
+ CAIMEI.Alert(r.msg, '确定', false);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ setCreatDataInfo(data){
|
|
|
+ const today = new Date()
|
|
|
+ this.listData = data.list.map((el)=>{
|
|
|
+ el.handlePostageFlag = el.postageFlag
|
|
|
+ return el
|
|
|
+ });
|
|
|
+
|
|
|
+ this.isContract = data.list.some(item => item.shopId === 11253)
|
|
|
+ // this.isContract = data.list.some(item => item.shopId === 1677)
|
|
|
+ // 格式化为 "YYYY年M月D日"(月份和日期不补零)
|
|
|
+ this.formattedDate = `${today.getFullYear()}年${today.getMonth() + 1}月${today.getDate()}日`
|
|
|
+ console.log(this.formattedDate) // 示例输出:2025年5月27日
|
|
|
+ this.totalPrice = data.totalPrice;
|
|
|
+ this.reducedPrice = data.reducedPrice;
|
|
|
+ this.totalCount = data.totalCount;
|
|
|
+ this.kindCount = data.kindCount;
|
|
|
+ this.userMoney = data.userMoney;
|
|
|
+ this.hanldShouldPayFee = data.totalPrice;
|
|
|
+ this.svipReducedPrice = data.svipReducedPrice;
|
|
|
+ this.returnGoodsStutas = data.returnGoodsStutas === 2 // 当前商品是否为特殊商品 1不是 2是
|
|
|
+ this.helpContent = data.helpContent
|
|
|
+ if( data.couponList && data.couponList.length>0){
|
|
|
+ this.isCouponShow = true;
|
|
|
+ this.couponAmount = data.couponList[0].couponAmount;
|
|
|
+ this.confirmParam.clubCouponId = data.couponList[0].clubCouponId;
|
|
|
+ this.couponList = data.couponList.map((el) =>{
|
|
|
+ return { ...el,...{ischecked:false}}
|
|
|
+ })
|
|
|
+ this.couponList[0].ischecked = true;
|
|
|
+ this.hanldShouldPayFee = data.totalPrice - this.couponAmount;
|
|
|
+ }
|
|
|
+ this.totalDiscountAmount = this.reducedPrice + this.couponAmount;
|
|
|
+ if(data.invoice){
|
|
|
+ data.invoice.type = 0;
|
|
|
+ this.orderInvoice = { ...this.orderInvoice , ...data.invoice } ;
|
|
|
+ this.orderInvoice.headingType = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+}();
|
|
|
+
|