|
@@ -101,8 +101,8 @@
|
|
|
<navigator url="/pages/car/index" open-type="switchTab" class="to_car">
|
|
|
<image src="https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/car.png" class="car_icon"></image>
|
|
|
</navigator>
|
|
|
- <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">{{is_pay?'立即购买':'立即预约'}}</button>
|
|
|
- <button :class="productInfo.hide_orderbtn?'show_car hide_orderbtn ':'show_car'" data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
|
|
|
+ <button class="show_order" v-if="!productInfo.hide_orderbtn" data-eventsync="true" @click="showSpecPopup(1)">{{ is_pay ? '立即购买' : '立即预约' }}</button>
|
|
|
+ <button :class="productInfo.hide_orderbtn ? 'show_car hide_orderbtn ' : 'show_car'" data-eventsync="true" @click="showSpecPopup(2)">加入购物车</button>
|
|
|
</view>
|
|
|
<view class="to_bottom"> --- 到底了 --- </view>
|
|
|
<uni-popup ref="specPopup" :show="true" type="bottom" class="popup" background-color="#FFFFFF" @change="popupChange">
|
|
@@ -170,10 +170,10 @@
|
|
|
</view>
|
|
|
<view class="order_price" v-if="specBtnType == 1 || specBtnType == 3">合计: ¥{{ priceTotal }}</view>
|
|
|
<view class="order_btn">
|
|
|
- <button class="to_order" @click="createOrder()" v-if="specBtnType == 1" data-eventsync="true">{{is_pay?'购买':'预约'}}</button>
|
|
|
+ <button class="to_order" @click="createOrder()" v-if="specBtnType == 1" data-eventsync="true">{{ is_pay ? '购买' : '预约' }}</button>
|
|
|
<button class="to_car" @click="createCart()" v-if="specBtnType == 2" data-eventsync="true">加入购物车</button>
|
|
|
- <button class="to_order" @click="createOrder()" v-if="specBtnType == 3" data-eventsync="true">{{is_pay?'拼团购买':'拼团预约'}}</button>
|
|
|
- <button class="to_order" @click="createOrder()" v-if="specBtnType == 4" data-eventsync="true">{{ productInfo.regiment_title }}{{is_pay?'购买':'预约'}}</button>
|
|
|
+ <button class="to_order" @click="createOrder()" v-if="specBtnType == 3" data-eventsync="true">{{ is_pay ? '拼团购买' : '拼团预约' }}</button>
|
|
|
+ <button class="to_order" @click="createOrder()" v-if="specBtnType == 4" data-eventsync="true">{{ productInfo.regiment_title }}{{ is_pay ? '购买' : '预约' }}</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</uni-popup>
|
|
@@ -199,9 +199,9 @@
|
|
|
<view class="coupon_name" v-if="item.rebate_type == 3">赠品券</view>
|
|
|
</view>
|
|
|
<view class="product_scope">
|
|
|
- <text class="" v-if="item.type_id == 1">{{ item.is_scope ? "当前商品可用" : "当前商品不可用" }}</text>
|
|
|
+ <text class="" v-if="item.type_id == 1">{{ item.is_scope ? '当前商品可用' : '当前商品不可用' }}</text>
|
|
|
<text class="" v-if="item.type_id == 2">全场可用</text>
|
|
|
- <text class="" v-if="item.type_id == 3">{{ item.is_scope ? "当前商品可用" : "当前商品不可用" }}</text>
|
|
|
+ <text class="" v-if="item.type_id == 3">{{ item.is_scope ? '当前商品可用' : '当前商品不可用' }}</text>
|
|
|
<view class="check_label">
|
|
|
<view class="isstd" v-if="!item.is_std">未达标</view>
|
|
|
<image
|
|
@@ -294,27 +294,27 @@ export default {
|
|
|
show: false, // 使用Popup组件时,阻止禁止滚动穿透
|
|
|
productInfo: {
|
|
|
id: 0,
|
|
|
- name: "",
|
|
|
- price: "0.00",
|
|
|
- market_price: "0.00",
|
|
|
- hide_orderbtn:0,
|
|
|
- spec: "",
|
|
|
+ name: '',
|
|
|
+ price: '0.00',
|
|
|
+ market_price: '0.00',
|
|
|
+ hide_orderbtn: 0,
|
|
|
+ spec: '',
|
|
|
stock: 0,
|
|
|
- thumb: "",
|
|
|
- poster: "",
|
|
|
- description: "",
|
|
|
- regiment_title: "",
|
|
|
- promo_title: "",
|
|
|
+ thumb: '',
|
|
|
+ poster: '',
|
|
|
+ description: '',
|
|
|
+ regiment_title: '',
|
|
|
+ promo_title: '',
|
|
|
automatic_info: {
|
|
|
- end_time: "",
|
|
|
+ end_time: '',
|
|
|
},
|
|
|
regiment_active: [],
|
|
|
business_info: {
|
|
|
- name: "",
|
|
|
- logopic: "",
|
|
|
- desc: "",
|
|
|
+ name: '',
|
|
|
+ logopic: '',
|
|
|
+ desc: '',
|
|
|
},
|
|
|
- regiment_price: "0.00",
|
|
|
+ regiment_price: '0.00',
|
|
|
regiment_quota: 0,
|
|
|
regiment_list: [],
|
|
|
product_attr: [],
|
|
@@ -329,11 +329,11 @@ export default {
|
|
|
// 数量
|
|
|
quantity: 1,
|
|
|
// 总价
|
|
|
- priceTotal: "0.00",
|
|
|
+ priceTotal: '0.00',
|
|
|
// 优惠券列表
|
|
|
couponList: [],
|
|
|
// 优惠券使用
|
|
|
- couponUsed: "去使用 >",
|
|
|
+ couponUsed: '去使用 >',
|
|
|
// 扣减金额
|
|
|
rebatePrice: 0.0,
|
|
|
// 已经选择的优惠券ID
|
|
@@ -345,25 +345,25 @@ export default {
|
|
|
// 已选地址
|
|
|
checkedAddr: {
|
|
|
id: 0,
|
|
|
- contact_name: "",
|
|
|
- contact_shop: "",
|
|
|
- contact_phone: "",
|
|
|
- contact_province: "",
|
|
|
- contact_city: "",
|
|
|
- contact_area: "",
|
|
|
- contact_addr: "",
|
|
|
+ contact_name: '',
|
|
|
+ contact_shop: '',
|
|
|
+ contact_phone: '',
|
|
|
+ contact_province: '',
|
|
|
+ contact_city: '',
|
|
|
+ contact_area: '',
|
|
|
+ contact_addr: '',
|
|
|
is_default: 0,
|
|
|
show_type: 0,
|
|
|
},
|
|
|
// 客服二维码
|
|
|
- followQrcode: "",
|
|
|
+ followQrcode: '',
|
|
|
// 二维码链接
|
|
|
- follow_linkurl: "",
|
|
|
+ follow_linkurl: '',
|
|
|
// 是否登录状态
|
|
|
isShowPrice: false,
|
|
|
// 选择的skuid
|
|
|
sku_id: 0,
|
|
|
- sku_thumb: "",
|
|
|
+ sku_thumb: '',
|
|
|
regiment_id: 0,
|
|
|
is_pay: 0,
|
|
|
};
|
|
@@ -380,7 +380,7 @@ export default {
|
|
|
}
|
|
|
var that = this;
|
|
|
// 监听地址变动
|
|
|
- uni.$on("addr_list_change", function (data) {
|
|
|
+ uni.$on('addr_list_change', function (data) {
|
|
|
// 地址列表
|
|
|
that.addrList = data.list;
|
|
|
});
|
|
@@ -388,22 +388,22 @@ export default {
|
|
|
//分享按钮
|
|
|
uni.showShareMenu({
|
|
|
withShareTicket: true,
|
|
|
- menus: ["shareAppMessage", "shareTimeline"],
|
|
|
+ menus: ['shareAppMessage', 'shareTimeline'],
|
|
|
});
|
|
|
// #endif
|
|
|
},
|
|
|
onShareAppMessage(obj) {
|
|
|
return {
|
|
|
title: `999智控终端平台\n${this.productInfo.name}`,
|
|
|
- path: "/pages/product/index?product_id=" + this.productInfo.id,
|
|
|
+ path: '/pages/product/index?product_id=' + this.productInfo.id,
|
|
|
promise: new Promise((resolve, reject) => {
|
|
|
- this.$http.request("api/share_message/get_item", { item_id: this.productInfo.id, pages: "/pages/product/index" }).then((callback) => {
|
|
|
- console.log(callback, "api/share_message/get_item");
|
|
|
+ this.$http.request('api/share_message/get_item', { item_id: this.productInfo.id, pages: '/pages/product/index' }).then((callback) => {
|
|
|
+ console.log(callback, 'api/share_message/get_item');
|
|
|
let obj = {
|
|
|
- title: callback.data?.title == "" ? `999智控终端平台\n${this.productInfo.name}` : callback.data.title,
|
|
|
- path: "/pages/product/index?product_id=" + this.productInfo.id,
|
|
|
+ title: callback.data?.title == '' ? `999智控终端平台\n${this.productInfo.name}` : callback.data.title,
|
|
|
+ path: '/pages/product/index?product_id=' + this.productInfo.id,
|
|
|
};
|
|
|
- if (callback.data?.image_url !== "") {
|
|
|
+ if (callback.data?.image_url !== '') {
|
|
|
obj.imageUrl = callback.data.image_url;
|
|
|
}
|
|
|
resolve(obj);
|
|
@@ -417,40 +417,40 @@ export default {
|
|
|
// 如果有添加二维码的话,获取客户信息
|
|
|
if (this.$checkAccess.getFollowQrcode()) {
|
|
|
// 判断数据
|
|
|
- this.$http.request("api/custom/get_info").then((callback) => {
|
|
|
- if (callback.code == "success") {
|
|
|
- if (!callback.data.userpic) callback.data.userpic = "https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png";
|
|
|
+ this.$http.request('api/custom/get_info').then((callback) => {
|
|
|
+ if (callback.code == 'success') {
|
|
|
+ if (!callback.data.userpic) callback.data.userpic = 'https://kailin-mp.oss-cn-shenzhen.aliyuncs.com/static/icon/doctor.png';
|
|
|
// 存储登录标识
|
|
|
- uni.setStorageSync("userInfo", callback.data);
|
|
|
+ uni.setStorageSync('userInfo', callback.data);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
// 如果存在产品ID的话
|
|
|
if (this.requestParam.id > 0) {
|
|
|
// 请求详情
|
|
|
- this.$http.request("api/product/get_detail", this.requestParam).then((re) => {
|
|
|
+ this.$http.request('api/product/get_detail', this.requestParam).then((re) => {
|
|
|
// 成功渲染数据
|
|
|
- if (re.code == "success") {
|
|
|
+ if (re.code == 'success') {
|
|
|
// 刷新数据
|
|
|
this.productInfo = re.data;
|
|
|
- //
|
|
|
+ //
|
|
|
if (this.productInfo.automatic_info.id) {
|
|
|
this.regiment_id = this.productInfo.automatic_info.id;
|
|
|
}
|
|
|
- //设置默认sku
|
|
|
- this.sku_id = 0;
|
|
|
- this.is_pay = this.productInfo.is_pay;
|
|
|
- // 显示图片
|
|
|
- this.sku_thumb = this.productInfo.thumb;
|
|
|
- // 如果只有一个SKU,默认选择一个
|
|
|
- if ( this.productInfo.product_attr.length == 1) {
|
|
|
- // 设置对应的属性已经选中
|
|
|
- if ( this.productInfo.product_attr[0].attr_list.length == 1 ) {
|
|
|
- this.attrChange(0,0);
|
|
|
+ //设置默认sku
|
|
|
+ this.sku_id = 0;
|
|
|
+ this.is_pay = this.productInfo.is_pay;
|
|
|
+ // 显示图片
|
|
|
+ this.sku_thumb = this.productInfo.thumb;
|
|
|
+ // 如果只有一个SKU,默认选择一个
|
|
|
+ if (this.productInfo.product_attr.length == 1) {
|
|
|
+ // 设置对应的属性已经选中
|
|
|
+ if (this.productInfo.product_attr[0].attr_list.length == 1) {
|
|
|
+ this.attrChange(0, 0);
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- if (re.code != "no_login") {
|
|
|
+ if (re.code != 'no_login') {
|
|
|
uni.showModal({
|
|
|
content: re.msg,
|
|
|
showCancel: false,
|
|
@@ -485,7 +485,7 @@ export default {
|
|
|
// 地址弹出层
|
|
|
showAddrPopup() {
|
|
|
// 显示下单弹出层
|
|
|
- this.$refs.addrPopup.open("bottom");
|
|
|
+ this.$refs.addrPopup.open('bottom');
|
|
|
},
|
|
|
// 规格弹出层
|
|
|
showSpecPopup(type, regiment_id = 0) {
|
|
@@ -499,7 +499,7 @@ export default {
|
|
|
// 显示类型,1预约,2购物车,3拼团
|
|
|
this.specBtnType = type;
|
|
|
// 恢复优惠券使用按钮
|
|
|
- this.couponUsed = "去使用 >";
|
|
|
+ this.couponUsed = '去使用 >';
|
|
|
// 恢复扣减金额
|
|
|
this.rebatePrice = 0.0;
|
|
|
// 选择优惠券重置
|
|
@@ -507,28 +507,28 @@ export default {
|
|
|
// 计算价格
|
|
|
this.priceHandler();
|
|
|
// 显示下单弹出层
|
|
|
- this.$refs.specPopup.open("bottom");
|
|
|
- // 如果非团购的话,查询优惠券
|
|
|
- if( type == 3 || type == 4 ){
|
|
|
- // 选择优惠券重置
|
|
|
- this.couponList = [];
|
|
|
- // 已经选择的优惠券ID
|
|
|
- this.customCoupon = 0;
|
|
|
- // 计算扣减
|
|
|
- this.couponRebate();
|
|
|
- // 计算价格
|
|
|
- this.priceHandler();
|
|
|
- }else{
|
|
|
- // 结果
|
|
|
- this.$http.request("api/custom_coupon/get_checked", this.requestParam).then((re) => {
|
|
|
- if (re.code == "success") {
|
|
|
- // 赋值
|
|
|
- this.couponList = re.data;
|
|
|
- // 优惠券是否可用
|
|
|
- this.checkCoupon();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+ this.$refs.specPopup.open('bottom');
|
|
|
+ // 如果非团购的话,查询优惠券
|
|
|
+ if (type == 3 || type == 4) {
|
|
|
+ // 选择优惠券重置
|
|
|
+ this.couponList = [];
|
|
|
+ // 已经选择的优惠券ID
|
|
|
+ this.customCoupon = 0;
|
|
|
+ // 计算扣减
|
|
|
+ this.couponRebate();
|
|
|
+ // 计算价格
|
|
|
+ this.priceHandler();
|
|
|
+ } else {
|
|
|
+ // 结果
|
|
|
+ this.$http.request('api/custom_coupon/get_checked', this.requestParam).then((re) => {
|
|
|
+ if (re.code == 'success') {
|
|
|
+ // 赋值
|
|
|
+ this.couponList = re.data;
|
|
|
+ // 优惠券是否可用
|
|
|
+ this.checkCoupon();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
// 地址列表
|
|
|
this.getAddrList();
|
|
|
//只有一组sku时是否下架
|
|
@@ -538,11 +538,11 @@ export default {
|
|
|
},
|
|
|
// 拼团列表弹出层
|
|
|
openRegiment() {
|
|
|
- this.$refs.regiment.open("bottom");
|
|
|
+ this.$refs.regiment.open('bottom');
|
|
|
},
|
|
|
// 优惠券弹出层
|
|
|
openCoupon() {
|
|
|
- this.$refs.couponPopup.open("bottom");
|
|
|
+ this.$refs.couponPopup.open('bottom');
|
|
|
},
|
|
|
// 数量调整
|
|
|
changeQuantity(number) {
|
|
@@ -555,23 +555,23 @@ export default {
|
|
|
if (this.quantity > this.productInfo.stock) {
|
|
|
this.quantity = this.productInfo.stock;
|
|
|
uni.showToast({
|
|
|
- title: "库存不足",
|
|
|
- icon: "none",
|
|
|
+ title: '库存不足',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
}
|
|
|
if ((this.specBtnType === 3 || this.specBtnType == 4) && this.quantity > this.productInfo.regiment_quota) {
|
|
|
this.quantity = this.productInfo.regiment_quota;
|
|
|
uni.showToast({
|
|
|
- title: "拼团限购" + this.productInfo.regiment_quota + "份",
|
|
|
- icon: "none",
|
|
|
+ title: '拼团限购' + this.productInfo.regiment_quota + '份',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
}
|
|
|
// 如果小于1.设置为1
|
|
|
if (this.quantity < 1) {
|
|
|
this.quantity = 1;
|
|
|
uni.showToast({
|
|
|
- title: "数量不可以小于0",
|
|
|
- icon: "none",
|
|
|
+ title: '数量不可以小于0',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
}
|
|
|
// 计算价格
|
|
@@ -593,24 +593,24 @@ export default {
|
|
|
skuname.push(this.productInfo.product_attr[i].spec_name);
|
|
|
}
|
|
|
uni.showToast({
|
|
|
- title: "请选择" + skuname.join(" 与 "),
|
|
|
- icon: "none",
|
|
|
+ title: '请选择' + skuname.join(' 与 '),
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// 下单数量小于0
|
|
|
if (this.quantity < 1) {
|
|
|
uni.showToast({
|
|
|
- title: "至少购买1个",
|
|
|
- icon: "none",
|
|
|
+ title: '至少购买1个',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// 如果大于库存设置为库存
|
|
|
if (this.productInfo.stock < 1) {
|
|
|
uni.showToast({
|
|
|
- title: "库存不足",
|
|
|
- icon: "none",
|
|
|
+ title: '库存不足',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -618,8 +618,8 @@ export default {
|
|
|
if (this.productInfo.stock < this.quantity) {
|
|
|
this.quantity = this.productInfo.stock;
|
|
|
uni.showToast({
|
|
|
- title: "库存不足",
|
|
|
- icon: "none",
|
|
|
+ title: '库存不足',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -627,23 +627,23 @@ export default {
|
|
|
if (this.quantity > this.productInfo.regiment_quota) {
|
|
|
this.quantity = this.productInfo.regiment_quota;
|
|
|
uni.showToast({
|
|
|
- title: "拼团限购" + this.productInfo.regiment_quota + "份",
|
|
|
- icon: "none",
|
|
|
+ title: '拼团限购' + this.productInfo.regiment_quota + '份',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
const timestamp = Math.round(new Date().getTime() / 1000).toString();
|
|
|
if (timestamp > this.productInfo.regiment_active.end_time) {
|
|
|
uni.showToast({
|
|
|
- title: "拼团活动已结束",
|
|
|
- icon: "none",
|
|
|
+ title: '拼团活动已结束',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
if (this.specBtnType === 4 && timestamp > this.productInfo.automatic_info.end_time) {
|
|
|
uni.showToast({
|
|
|
- title: "该团已过期",
|
|
|
- icon: "none",
|
|
|
+ title: '该团已过期',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -680,7 +680,7 @@ export default {
|
|
|
// 请求接口
|
|
|
this.$http
|
|
|
.request(
|
|
|
- "api/orders/create_regiment",
|
|
|
+ 'api/orders/create_regiment',
|
|
|
{
|
|
|
product_list: productList,
|
|
|
// custom_coupon_id: this.customCoupon,
|
|
@@ -690,23 +690,23 @@ export default {
|
|
|
regiment_active_id: this.productInfo.regiment_active_id,
|
|
|
is_pay: this.is_pay,
|
|
|
},
|
|
|
- "post"
|
|
|
+ 'post'
|
|
|
)
|
|
|
.then((re) => {
|
|
|
// 判断结果
|
|
|
- if (re.code == "success") {
|
|
|
+ if (re.code == 'success') {
|
|
|
// 处理结果
|
|
|
this.productInfo.stock = this.productInfo.stock - this.quantity;
|
|
|
// 关闭弹窗
|
|
|
this.$refs.specPopup.close();
|
|
|
- if (this.is_pay){
|
|
|
+ if (this.is_pay) {
|
|
|
//订单详情
|
|
|
let orderInfo = re.data;
|
|
|
- orderInfo = JSON.stringify(orderInfo)
|
|
|
+ orderInfo = JSON.stringify(orderInfo);
|
|
|
let params = encodeURIComponent(orderInfo);
|
|
|
// 跳转到确认支付页面
|
|
|
- uni.navigateTo({url:`/pages/orders/confirm?params=${params}`});
|
|
|
- }else {
|
|
|
+ uni.navigateTo({ url: `/pages/orders/confirm?params=${params}` });
|
|
|
+ } else {
|
|
|
// 跳转到报单完成页面
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/orders/completion?params=${encodedArray}`,
|
|
@@ -723,30 +723,30 @@ export default {
|
|
|
// 请求接口
|
|
|
this.$http
|
|
|
.request(
|
|
|
- "api/orders/create",
|
|
|
+ 'api/orders/create',
|
|
|
{
|
|
|
product_list: productList,
|
|
|
custom_coupon_id: this.customCoupon,
|
|
|
addr_id: this.checkedAddr.id,
|
|
|
is_pay: this.is_pay,
|
|
|
},
|
|
|
- "post"
|
|
|
+ 'post'
|
|
|
)
|
|
|
.then((re) => {
|
|
|
// 判断结果
|
|
|
- if (re.code == "success") {
|
|
|
+ if (re.code == 'success') {
|
|
|
// 处理结果
|
|
|
this.productInfo.stock = this.productInfo.stock - this.quantity;
|
|
|
// 关闭弹窗
|
|
|
this.$refs.specPopup.close();
|
|
|
- if (this.is_pay){
|
|
|
+ if (this.is_pay) {
|
|
|
//订单详情
|
|
|
let orderInfo = re.data;
|
|
|
- orderInfo = JSON.stringify(orderInfo)
|
|
|
+ orderInfo = JSON.stringify(orderInfo);
|
|
|
let params = encodeURIComponent(orderInfo);
|
|
|
// 跳转到确认支付页面
|
|
|
- uni.navigateTo({url:`/pages/orders/confirm?params=${params}`});
|
|
|
- }else {
|
|
|
+ uni.navigateTo({ url: `/pages/orders/confirm?params=${params}` });
|
|
|
+ } else {
|
|
|
// 跳转到报单完成页面
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/orders/completion?params=${encodedArray}`,
|
|
@@ -775,23 +775,23 @@ export default {
|
|
|
skuname.push(this.productInfo.product_attr[i].spec_name);
|
|
|
}
|
|
|
uni.showToast({
|
|
|
- title: "请选择" + skuname.join(" 与 "),
|
|
|
- icon: "none",
|
|
|
+ title: '请选择' + skuname.join(' 与 '),
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// 下单数量小于0
|
|
|
if (this.quantity < 1) {
|
|
|
uni.showToast({
|
|
|
- title: "至少购买1个",
|
|
|
+ title: '至少购买1个',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
// 如果库存不足
|
|
|
if (this.productInfo.stock < 1) {
|
|
|
uni.showToast({
|
|
|
- title: "库存不足",
|
|
|
- icon: "none",
|
|
|
+ title: '库存不足',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -799,8 +799,8 @@ export default {
|
|
|
if (this.productInfo.stock < this.quantity) {
|
|
|
this.quantity = this.productInfo.stock;
|
|
|
uni.showToast({
|
|
|
- title: "库存不足",
|
|
|
- icon: "none",
|
|
|
+ title: '库存不足',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
@@ -811,21 +811,21 @@ export default {
|
|
|
skuid: this.sku_id,
|
|
|
};
|
|
|
// 请求接口
|
|
|
- this.$http.request("api/shop_cart/add", data, "post").then((re) => {
|
|
|
+ this.$http.request('api/shop_cart/add', data, 'post').then((re) => {
|
|
|
// 判断结果
|
|
|
- if (re.code == "success") {
|
|
|
+ if (re.code == 'success') {
|
|
|
// 跳转到订单列表
|
|
|
uni.showToast({
|
|
|
- icon: "success",
|
|
|
- title: "加入购物车成功",
|
|
|
+ icon: 'success',
|
|
|
+ title: '加入购物车成功',
|
|
|
});
|
|
|
// 关闭结果
|
|
|
this.$refs.specPopup.close();
|
|
|
} else {
|
|
|
// 跳转到订单列表
|
|
|
uni.showToast({
|
|
|
- icon: "error",
|
|
|
- title: "加入购物车失败",
|
|
|
+ icon: 'error',
|
|
|
+ title: '加入购物车失败',
|
|
|
});
|
|
|
}
|
|
|
});
|
|
@@ -921,7 +921,7 @@ export default {
|
|
|
if (index != i) this.couponList[i].checked = 0;
|
|
|
}
|
|
|
// 如果未选中,提示可用
|
|
|
- if (!this.couponList[index].checked) this.couponUsed = "去使用 >";
|
|
|
+ if (!this.couponList[index].checked) this.couponUsed = '去使用 >';
|
|
|
// 已经选择的优惠券ID
|
|
|
this.customCoupon = this.couponList[index].checked ? this.couponList[index].id : 0;
|
|
|
// 计算扣减
|
|
@@ -994,7 +994,7 @@ export default {
|
|
|
// 计算扣减数据
|
|
|
rebatePrice = this.$decimal.mul(this.couponList[i].rebate, 1);
|
|
|
// 替换文字
|
|
|
- this.couponUsed = "¥-" + rebatePrice.toFixed(2);
|
|
|
+ this.couponUsed = '¥-' + rebatePrice.toFixed(2);
|
|
|
}
|
|
|
// 折扣
|
|
|
if (this.couponList[i].rebate_type == 2) {
|
|
@@ -1003,12 +1003,12 @@ export default {
|
|
|
// 减数
|
|
|
rebatePrice = this.$decimal.sub(totalPrice, rebatePrice.mul(0.1));
|
|
|
// 替换文字
|
|
|
- this.couponUsed = "¥-" + rebatePrice.toFixed(2);
|
|
|
+ this.couponUsed = '¥-' + rebatePrice.toFixed(2);
|
|
|
}
|
|
|
// 赠品
|
|
|
if (this.couponList[i].rebate_type == 3) {
|
|
|
// 替换文字
|
|
|
- this.couponUsed = "送" + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : "");
|
|
|
+ this.couponUsed = '送' + (this.couponList[i].rebate_scope.length ? this.couponList[i].rebate_scope[0].product_name : '');
|
|
|
}
|
|
|
// 小数点保留
|
|
|
this.rebatePrice = rebatePrice.toFixed(2);
|
|
@@ -1026,9 +1026,9 @@ export default {
|
|
|
},
|
|
|
getAddrList() {
|
|
|
// 判断数据
|
|
|
- this.$http.request("api/custom_addr/get_list").then((callback) => {
|
|
|
+ this.$http.request('api/custom_addr/get_list').then((callback) => {
|
|
|
// 获取成功
|
|
|
- if (callback.code == "success") {
|
|
|
+ if (callback.code == 'success') {
|
|
|
this.addrList = callback.data;
|
|
|
// 如果有的话
|
|
|
if (this.addrList.length) {
|
|
@@ -1052,7 +1052,7 @@ export default {
|
|
|
// 返回结果
|
|
|
this.follow_linkurl = this.$checkAccess.getFollowLinkUrl();
|
|
|
// 有图才展示
|
|
|
- if (this.followQrcode) this.$refs.addFollow.open("center");
|
|
|
+ if (this.followQrcode) this.$refs.addFollow.open('center');
|
|
|
},
|
|
|
closeAddFollow() {
|
|
|
this.$refs.addFollow.close();
|
|
@@ -1086,7 +1086,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
// 转成字符串
|
|
|
- var attrids = attr_ids.join(",");
|
|
|
+ var attrids = attr_ids.join(',');
|
|
|
// 如果选项不足的话
|
|
|
if (attr_ids.length != this.productInfo.product_attr.length) return;
|
|
|
// 如果当前点击的属性对应的SKU状态为未下架(初始化为0)
|
|
@@ -1106,8 +1106,8 @@ export default {
|
|
|
// 如果商品已经下架(status等于1),则恢复当前规格下所有属性原来的active状态
|
|
|
if (currentSKUStatus === 1) {
|
|
|
uni.showToast({
|
|
|
- title: "该规格已下架",
|
|
|
- icon: "none",
|
|
|
+ title: '该规格已下架',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
for (let k in originalActiveStates) {
|
|
|
this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
|
|
@@ -1117,8 +1117,8 @@ export default {
|
|
|
// 如果商品没有库存
|
|
|
if (this.productInfo.product_sku[i].stock <= 0) {
|
|
|
uni.showToast({
|
|
|
- title: "该规格库存不足",
|
|
|
- icon: "none",
|
|
|
+ title: '该规格库存不足',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
for (let k in originalActiveStates) {
|
|
|
this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
|
|
@@ -1149,8 +1149,8 @@ export default {
|
|
|
// 如果没有对应的SKU
|
|
|
if (!haveSku) {
|
|
|
uni.showToast({
|
|
|
- title: "该规格已下架",
|
|
|
- icon: "none",
|
|
|
+ title: '该规格已下架',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
for (let k in originalActiveStates) {
|
|
|
this.productInfo.product_attr[spec_index].attr_list[k].active = originalActiveStates[k];
|
|
@@ -1163,17 +1163,17 @@ export default {
|
|
|
if (this.productInfo.product_sku.length) {
|
|
|
if (this.productInfo.product_sku[0].status === 1) {
|
|
|
uni.showToast({
|
|
|
- title: "该规格已下架",
|
|
|
- icon: "none",
|
|
|
+ title: '该规格已下架',
|
|
|
+ icon: 'none',
|
|
|
});
|
|
|
this.productInfo.stock = 0;
|
|
|
- var attr_ids = this.productInfo.product_sku[0].attr_ids.split(",");
|
|
|
+ var attr_ids = this.productInfo.product_sku[0].attr_ids.split(',');
|
|
|
// 循环规格列表
|
|
|
for (let i in this.productInfo.product_attr) {
|
|
|
// 再循环属性
|
|
|
for (let j in this.productInfo.product_attr[i].attr_list) {
|
|
|
// 如果不等于id
|
|
|
- if (attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + "")) {
|
|
|
+ if (attr_ids.includes(this.productInfo.product_attr[i].attr_list[j].id + '')) {
|
|
|
// 取消选中
|
|
|
this.productInfo.product_attr[i].attr_list[j].active = 0;
|
|
|
}
|
|
@@ -1186,17 +1186,17 @@ export default {
|
|
|
// 去往webview
|
|
|
followLinkurl() {
|
|
|
// 获取登录标识
|
|
|
- let userInfo = uni.getStorageSync("userInfo");
|
|
|
+ let userInfo = uni.getStorageSync('userInfo');
|
|
|
// 如果不存在的话
|
|
|
- if (!userInfo) return "";
|
|
|
+ if (!userInfo) return '';
|
|
|
// 未添加好友
|
|
|
- if (!userInfo.follow_linkurl) return "";
|
|
|
+ if (!userInfo.follow_linkurl) return '';
|
|
|
// 获取Url
|
|
|
let url = userInfo.follow_linkurl;
|
|
|
// 没有路径,不跳转
|
|
|
if (!url) return;
|
|
|
// 判断是不是小程序链接
|
|
|
- if (url.includes("http")) {
|
|
|
+ if (url.includes('http')) {
|
|
|
// 转码
|
|
|
let link_url = encodeURIComponent(url);
|
|
|
// 跳转到webview
|
|
@@ -1428,11 +1428,11 @@ export default {
|
|
|
border-top-left-radius: 20rpx;
|
|
|
border-bottom-left-radius: 20rpx;
|
|
|
}
|
|
|
-
|
|
|
- .show_car.hide_orderbtn{
|
|
|
- width: 580rpx;
|
|
|
- border-radius: 20rpx;
|
|
|
- margin-right: 35rpx;
|
|
|
+
|
|
|
+ .show_car.hide_orderbtn {
|
|
|
+ width: 580rpx;
|
|
|
+ border-radius: 20rpx;
|
|
|
+ margin-right: 35rpx;
|
|
|
}
|
|
|
|
|
|
.to_car {
|