Browse Source

店铺包邮

master
jiazhipeng 7 days ago
parent
commit
2aa6e1de73
  1. 8
      static/js/request.js
  2. 6
      subPackages/order/cartOrder.vue
  3. 63
      subPackages/techan/cartOrder.vue
  4. 66
      subPackages/techan/cartOrder1.vue
  5. 5
      subPackages/techan/detail.vue
  6. 62
      subPackages/techan/order.vue
  7. 123
      subPackages/user/rewardsCenter.vue

8
static/js/request.js

@ -3,10 +3,10 @@ import store from '@/store';
// 定义 API URL // 定义 API URL
// const DEV_API_URL = 'https://api.cloud.sz-trip.com'; // const DEV_API_URL = 'https://api.cloud.sz-trip.com';
const DEV_API_URL = 'https://api.sutenong.com' // const DEV_API_URL = 'https://api.sutenong.com'
const PROD_API_URL = 'https://api.sutenong.com'; // const PROD_API_URL = 'https://api.sutenong.com';
// const DEV_API_URL = 'https://swsz.api.js-dyyj.com'; const DEV_API_URL = 'https://swsz.api.js-dyyj.com';
// const PROD_API_URL = 'https://swsz.api.js-dyyj.com'; const PROD_API_URL = 'https://swsz.api.js-dyyj.com';
const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL; const NEWAPIURL = process.env.NODE_ENV === 'development' ? DEV_API_URL : PROD_API_URL;
// 获取token // 获取token

6
subPackages/order/cartOrder.vue

@ -86,7 +86,11 @@
<view class="other-info"> <view class="other-info">
<view class="flex-between"> <view class="flex-between">
<view>运费:</view> <view>运费:</view>
<view>{{item.post/100}}</view> <view>
<text style="color: #a1a1a1;text-decoration: line-through;padding-right: 10rpx;"
v-if="item.postDiscount>0">{{item.postPrice/100}}</text>
<text>{{item.post/100}}</text>
</view>
</view> </view>
<view class="flex-between" style="align-items: flex-start;"> <view class="flex-between" style="align-items: flex-start;">
<view class="flex-shrink-0">收货人信息:</view> <view class="flex-shrink-0">收货人信息:</view>

63
subPackages/techan/cartOrder.vue

@ -117,7 +117,9 @@
运费 运费
</view> </view>
<view style="font-weight: 500;" > <view style="font-weight: 500;" >
{{!info.post?'免邮':info.post/100}} <text style="color: #a1a1a1;text-decoration: line-through;padding-right: 10rpx;"
v-if="info.postDiscount>0">{{info.postPrice/100}}</text>
<text>{{!info.post?'免邮':info.post/100}}</text>
</view> </view>
</view> </view>
@ -403,25 +405,56 @@ export default {
}) })
let param = [] let param = []
let consignee_id = null
tempList.forEach(v=>{ tempList.forEach(v=>{
param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) // param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id})
param.push({
type: v.pInfo.type,
product_id: v.pInfo.id,
sku_id: v.sInfo.id,
product_num: v.sInfo.buyNum,
use_type: 1,
post: v.contacts.id,
consignee_id: v.contacts.id,
})
consignee_id = v.contacts.id
}) })
let data = JSON.stringify(param); //
// console.log(data); // console.log(data);
this.flag = false; // this.flag = false;
Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{ // Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{
if (res) { // if (res) {
console.log("promise" ,res) // console.log("promise" ,res)
for(let i=0;i<tempList.length;i++) { // for(let i=0;i<tempList.length;i++) {
tempList[i].post = res[i].data.price; // tempList[i].post = res[i].data.price;
// }
// }
// }).finally(()=>{this.flag = true;})
//
if (consignee_id && param.length>0) {
let data = {
product_list: param,
consignee_id:consignee_id
};
this.Post({
method: 'POST',
data: JSON.stringify(data),
consignee_id:consignee_id
},"/api/order/get_post_price_new").then(res=>{
let resData = res.data || []
resData.forEach((x,i) => {
tempList[i].post = x.price - x.discount_price
tempList[i].postPrice = x.price
tempList[i].postDiscount = x.discount_price
})
this.$forceUpdate()
})
} }
}
}).finally(()=>{this.flag = true;})
}, },
plus(sku) { plus(sku) {
this.$nextTick(() => { this.$nextTick(() => {
this.$store.commit("choseCoupon",""); this.$store.commit("choseCoupon","");
@ -585,6 +618,8 @@ export default {
} else { } else {
param.use_type = 1 param.use_type = 1
param.post = info.contacts.id param.post = info.contacts.id
param.postPrice = param.postPrice
param.postDiscount = param.postDiscount
} }
} }
if (info.is_user_post == 2) { if (info.is_user_post == 2) {

66
subPackages/techan/cartOrder1.vue

@ -117,7 +117,9 @@
运费 运费
</view> </view>
<view style="font-weight: 500;" > <view style="font-weight: 500;" >
{{!info.post?'免邮':info.post/100}} <text style="color: #a1a1a1;text-decoration: line-through;padding-right: 10rpx;"
v-if="info.postDiscount>0">{{info.postPrice/100}}</text>
<text>{{!info.post?'免邮':info.post/100}}</text>
</view> </view>
</view> </view>
@ -394,23 +396,55 @@ export default {
}) })
let param = [] let param = []
let consignee_id = null
tempList.forEach(v=>{ tempList.forEach(v=>{
param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) // param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id})
param.push({
type: v.pInfo.type,
product_id: v.pInfo.id,
sku_id: v.sInfo.id,
product_num: v.sInfo.buyNum,
use_type: 1,
post: v.contacts.id,
consignee_id: v.contacts.id,
})
consignee_id = v.contacts.id
}) })
let data = JSON.stringify(param); //
// console.log(data); // console.log(data);
this.flag = false; // this.flag = false;
Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{ // Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{
if (res) { // if (res) {
console.log("promise" ,res) // console.log("promise" ,res)
for(let i=0;i<tempList.length;i++) { // for(let i=0;i<tempList.length;i++) {
tempList[i].post = res[i].data.price; // tempList[i].post = res[i].data.price;
} // }
} // }
}).finally(()=>{this.flag = true;}) // }).finally(()=>{this.flag = true;})
//
if (consignee_id && param.length>0) {
let data = {
product_list: param,
consignee_id:consignee_id
};
this.Post({
method: 'POST',
data: JSON.stringify(data),
consignee_id:consignee_id
},"/api/order/get_post_price_new").then(res=>{
let resData = res.data || []
resData.forEach((x,i) => {
tempList[i].post = x.price - x.discount_price
tempList[i].postPrice = x.price
tempList[i].postDiscount = x.discount_price
})
this.$forceUpdate()
})
}
}, },
plus(sku) { plus(sku) {
@ -557,8 +591,6 @@ export default {
}, },
// //
order() { order() {
let goods = []; let goods = [];
for(let info of this.orderList) { for(let info of this.orderList) {
let param = { let param = {
@ -578,6 +610,8 @@ export default {
} else { } else {
param.use_type = 1 param.use_type = 1
param.post = info.contacts.id param.post = info.contacts.id
param.postPrice = param.postPrice
param.postDiscount = param.postDiscount
} }
} }
if (info.is_user_post == 2) { if (info.is_user_post == 2) {

5
subPackages/techan/detail.vue

@ -38,7 +38,10 @@
<text class="present-price">{{ info.price / 100 }}</text> <text class="present-price">{{ info.price / 100 }}</text>
/ /
</view> </view>
<view>已售{{info.sales_number || 0}}</view> <view>
<text v-if="supplierInfo&&supplierInfo.sill_money>0" style="padding-right: 8rpx;">全店满{{supplierInfo.sill_money/100||0}}包邮 |</text>
<text>已售{{info.sales_number || 0}}</text>
</view>
</view> </view>
<view class="title text-overflowRows">{{ info.title }}</view> <view class="title text-overflowRows">{{ info.title }}</view>

62
subPackages/techan/order.vue

@ -89,7 +89,9 @@
运费 运费
</view> </view>
<view style="font-weight: 500;" > <view style="font-weight: 500;" >
{{!info.post?'免邮':info.post/100}} <text style="color: #a1a1a1;text-decoration: line-through;padding-right: 10rpx;"
v-if="info.postDiscount>0">{{info.postPrice/100}}</text>
<text>{{!info.post?'免邮':info.post/100}}</text>
</view> </view>
</view> </view>
@ -365,23 +367,55 @@ export default {
}) })
let param = [] let param = []
let consignee_id = null
tempList.forEach(v=>{ tempList.forEach(v=>{
param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id}) // param.push({sku_id: v.sInfo.id, num: v.sInfo.buyNum, consignee_id:v.contacts.id})
param.push({
type: v.pInfo.type,
product_id: v.pInfo.id,
sku_id: v.sInfo.id,
product_num: v.sInfo.buyNum,
use_type: 1,
post: v.contacts.id,
consignee_id: v.contacts.id,
})
consignee_id = v.contacts.id
}) })
let data = JSON.stringify(param); //
// console.log(data); // console.log(data);
this.flag = false; // this.flag = false;
Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{ // Promise.all(param.map(v=>_this.Post({...v},"/api/order/get_post_price"))).then(res=>{
if (res) { // if (res) {
console.log("promise" ,res) // console.log("promise" ,res)
for(let i=0;i<tempList.length;i++) { // for(let i=0;i<tempList.length;i++) {
tempList[i].post = res[i].data.price; // tempList[i].post = res[i].data.price;
} // }
} // }
}).finally(()=>{this.flag = true;}) // }).finally(()=>{this.flag = true;})
//
if (consignee_id && param.length>0) {
let data = {
product_list: param,
consignee_id:consignee_id
};
this.Post({
method: 'POST',
data: JSON.stringify(data),
consignee_id:consignee_id
},"/api/order/get_post_price_new").then(res=>{
let resData = res.data || []
resData.forEach((x,i) => {
tempList[i].post = x.price - x.discount_price
tempList[i].postPrice = x.price
tempList[i].postDiscount = x.discount_price
})
this.$forceUpdate()
})
}
}, },
plus(sku) { plus(sku) {

123
subPackages/user/rewardsCenter.vue

@ -0,0 +1,123 @@
<template>
<view class="bg">
<view class="popupBox">
<view class="name">
兑换优惠券
</view>
<input type="text" v-model="password" placeholder="请输入兑换码">
<view class="btns">
<view class="cancel" @click="cancel">
取消
</view>
<span></span>
<view class="sub" @click="submitPassword">
兑换
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
password:''
}
},
onShow() {
},
methods: {
submitPassword() {
console.log('提交的兑换码',this.password);
let that = this
that.password = that.password.trim()
that.$refs.popup.close()
if (that.password== '') {
uni.showToast({
title: '请输入优惠券领取卡号',
icon: 'none'
})
return
}
that.Post({
card_key: that.password
}, "/api/coupon/getCoupon").then((res) => {
console.log(res.code);
if (res.code == 200) {
that.coupon = []
this.getList(this.navList[0])
uni.showToast({
title: '兑换成功',
icon: 'none'
})
} else{
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
that.password = ''
},
}
}
</script>
<style lang="scss" scoped>
.bg {
background: #F7F7F7;
min-height: 100vh;
}
.popupBox {
background: #fff;
border-radius: 20rpx;
padding: 40.67rpx 39.33rpx 35.33rpx 40rpx;
}
.popupBox .name {
font-size: 35rpx;
color: #111;
font-weight: bold;
margin-bottom: 57.33rpx;
text-align: center;
}
.popupBox input {
width: 454rpx;
height: 81rpx;
border: 1px solid #D8D8D8;
border-radius: 7rpx;
font-size: 31rpx;font-weight: 500;
color: #999999;
line-height: 81rpx;
margin: 0 39.33rpx 72.67rpx 40rpx;
text-align: center;
}
.popupBox .btns {
display: flex;
align-items: center;
font-size: 35rpx;
justify-content: space-around;
}
.popupBox .btns .cancel {
color: #111;
}
.popupBox .btns span {
width: 1rpx;
height: 53rpx;
background: #D8D8D8;
}
.popupBox .btns .sub {
color: #07C49B;
}
</style>
Loading…
Cancel
Save