未缴纳保证金
卖家公告
/ Notice
商品问题请咨询卖家qq:54920365
商品说明
/ Description
{{ getGoodsDesc }}

- 手机扫码支付更方便
请输入访问密码
店铺公告
暂无
我已了解
购卡协议
我已了解
},
computed: {
getGoodsDesc() {
return this.goodsInfo && this.goodsInfo.content ? this.goodsInfo.content : '暂无';
}
},
filters: {
default(value, def = '') {
if(!value) return def;
return value;
},
defaultFloat(value, def = 0.00) {
if(!value) return def;
return value;
},
defaultInt(value, def = 0) {
if(!value) return def;
return value;
}
},
methods: {
choose_goods(n){
this.active_goods = n;
if(parseInt(this.formInfo.quantity) < 1){
this.formInfo.quantity = 1;
}
this.formInfo.goods_id = this.goods_list[this.active_goods].goods_id;
this.getGoodsInfo();
},
visitPass() {
var need_pass = true;
var open_visit_pass = this.goodsInfo && this.goodsInfo.visit_type === 1;
if(!open_visit_pass) {
need_pass = false;
}
this.show_pass_modal = need_pass;
setTimeout(function () {
$('[name="password_visit"]').focus();
}, 100)
},
getGoodsInfo() {
var that = this;
if(!that.formInfo.goods_id) {
that.normalTips('亲,请选择您要购买的商品😙😙')
return false;
}
myAjax('/index/goods/getGoods', {shop_id: that.shop_id, goods_id: that.formInfo.goods_id}, null, function (res) {
layer.closeAll();
if (res.code === 1) {
that.goodsInfo = res.data.goods ? res.data.goods : {};
that.checkNum();
that.visitPass();
that.getTotalPrice();
if(that.is_login) {
myAjax('/cards_list', {shop_id: that.shop_id}, null, function (res) {
layer.closeAll();
if (res.code === 1) {
that.alreadyBuy = res.data.already_buy;
}
that.setCardStatus();
}, function () {
layer.closeAll();
that.errorTips();
});
}
} else {
that.normalTips(res.msg + '😮😮')
}
}, function () {
layer.closeAll();
that.errorTips();
});
},
changeBuyNum(type) {
if(type === '+') {
this.formInfo.quantity++;
this.checkNum();
} else {
if(this.formInfo.quantity <= 1) {
this.formInfo.quantity = 1;
} else {
this.formInfo.quantity--;
}
this.getTotalPrice();
}
},
checkNum() {
if(this.goodsInfo && this.formInfo.quantity >= this.goodsInfo.stock) {
this.formInfo.quantity = this.goodsInfo.stock;
}
this.getTotalPrice();
},
cancelPass(){
if(this.page_type === 'category') {
this.formInfo.goods_id = '';
this.goodsInfo = {};
this.getTotalPrice();
}
},
checkPass() {
var that = this;
var pass = that.formInfo.password_visit;
if(!pass) {
that.normalTips('请填写访问密码🙂🙂')
return false;
}
if(!/^\w{6,20}$/.test(pass)) {
that.normalTips('访问密码由6-20个长度,数字、大小写字母或组合!', 6)
return false;
}
myAjax('/ajax/checkpwdforbuy', {
pwdforbuy: pass,
goodid: that.formInfo.goods_id,
}, function () {
that.check_pass_loading = true;
}, function (res) {
that.check_pass_loading = false;
if(res === 'ok') {
that.show_pass_modal = false;
that.$Message.success('验证成功,请继续购买!');
} else {
that.normalTips('访问密码错误,如有疑问请联系商家❗', 5)
}
}, function () {
that.check_pass_loading = false;
that.errorTips();
}, 1.2)
},
changeSms() {
if(this.formInfo.is_rev_sms) {
this.formInfo.isemail = false;
$('[name="contact"]').focus();
}
this.getTotalPrice();
},
changeEmail () {
if(this.formInfo.isemail) {
this.formInfo.is_rev_sms = false;
setTimeout(function () {
$('[name="email"]').focus();
}, 100);
}
this.getTotalPrice();
},
changeChannel(index) {
this.active_channel = index;
var click_pid = this.channel_list[this.active_channel].channel_id;
this.formInfo.pid = click_pid;
this.getTotalPrice();
},
checkCoupon() {
if(this.formInfo.vip_card_id !== '') {
this.normalTips('已使用会员卡,无法使用优惠券😥😥');
return false;
}
this.is_yh = !this.is_yh;
this.formInfo.vip_card_id = '';
},
checkCouponCode() {
var that = this;
if(that.coup_check_loading) return false;
if(!that.formInfo.couponcode) {
this.normalTips('亲,您未填写优惠券码哟😝😝')
return false;
}
if(that.formInfo.couponcode.length !== 16) {
this.normalTips('亲,您输入的优惠券不是16位😝😝')
$('[name=couponcode]').focus();
return false;
}
myAjax('/ajax/checkcoupon',{
couponcode: that.formInfo.couponcode,
userid: that.formInfo.userid,
cateid: that.formInfo.cate_id,
}, function () {
that.coup_check_loading = true;
that.coup_is_check = false;
}, function (res) {
that.coup_check_loading = false;
if(res) {
if(res.result === 1) {
that.coup_is_check = true;
that.coup_res.status = true;
that.coup_res.msg = '恭喜您,可以使用该优惠券!';
that.formInfo.is_coupon = 1;
that.formInfo.coupon_ctype = res.ctype;
that.formInfo.coupon_value = res.coupon;
} else{
if(res.result === 0){
that.setCoupError('优惠券不存在或已过期');
} else {
that.setCoupError();
}
}
} else {
that.setCoupError();
}
that.getTotalPrice();
}, function () {
that.coup_check_loading = false;
that.errorTips();
that.setCoupError();
that.getTotalPrice();
}, 1.3)
},
setCoupError(msg = '验证失败') {
var that = this;
that.coup_is_check = true;
that.coup_res.msg = msg;
that.coup_res.status = false;
that.formInfo.is_coupon = 0;
that.formInfo.coupon_ctype = 0;
that.formInfo.coupon_value = 0;
this.getTotalPrice();
},
getTotalPrice() {
var that = this;
if(that.get_pay_loading) return false;
var data = {
vip_card_id: that.formInfo.vip_card_id,
cateid: that.formInfo.cate_id,
goods_num: that.formInfo.quantity,
goods_id: that.formInfo.goods_id,
use_cost: that.formInfo.is_rev_sms ? 1 : 0,// 是否使用短信提醒
couponcode: that.formInfo.couponcode,
pid: that.formInfo.pid,
mid:parseInt('0')
};
var goods_num = data.goods_num;
if(!data.goods_id) {
this.normalTips('亲,请选择您要购买的商品😙😙')
return false;
}
myAjax('/get_total_price', data, function () {
that.get_pay_loading = true;
}, function (res) {
that.get_pay_loading = false;
if(res.code === 1) {
var data = res.data;
that.total_price = data.total_price;
//that.goodsInfo.price = Math.floor(data.goods_price / goods_num);
// that.goodsInfo.price = (data.goods_price / goods_num);
var html_tpl = '商品价格 | ¥'+data.goods_price+'元 |
';
if(data.cost_price > 0) {
html_tpl += '短信提醒费用 | ¥'+data.cost_price+'元 |
';
}
if(data.charge_price > 0) {
html_tpl += '订单手续费用 | ¥'+data.charge_price+'元 |
';
}
if(data.coupon_price > 0) {
html_tpl += '优惠卷抵扣金额 | ¥'+data.coupon_price+'元 |
';
}
if(data.vip_price > 0) {
html_tpl += '会员卡优惠金额 | ¥'+data.vip_price+'元 |
';
} else {
if(that.formInfo.vip_card_id !== '') {
that.normalTips('抱歉,该会员卡不满足使用条件,请使用其他会员卡');
that.formInfo.vip_card_id = '';
}
}
html_tpl += '应付总额 | ¥'+that.total_price+'元 |
';
that.total_info = html_tpl;
} else {
that.total_info = '';
that.errorTips(res.msg)
switch (res.data) {
case -1:
// 余额不足回调操作
that.changeChannel(0)
break;
}
}
}, function () {
that.get_pay_loading = false;
that.total_info = '';
that.errorTips();
}, 0.1)
},
checkContact() {
if(!this.formInfo.contact) {
this.normalTips('亲,联系方式必须填写哟😥😥');
return false;
}
var reg_contact = this.formInfo.is_rev_sms ? /^\d{11}$/ : /^\d{4,20}$/;
if(!reg_contact.test(this.formInfo.contact)) {
if(this.formInfo.is_rev_sms) {
this.normalTips('亲,你已选择短信提醒,必须填写正确的手机号哟😥😥', 6);
} else {
this.normalTips('亲,您的联系方式填写是否正确😥😥');
}
return false;
}
return true;
},
checkEmail() {
if(this.formInfo.isemail) {
var reg_email = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
if(!reg_email.test(this.formInfo.email)) {
this.normalTips('亲,您的邮箱地址不正确哟😥😥', 6);
return false;
}
}
return true;
},
checkTakPss() {
var card_pass_reg = /^\w{6,20}$/
if(this.goodsInfo.take_card_type===1){
if(!this.formInfo.pwdforsearch1) {
this.normalTips('亲,取卡密码必须填写哟😥😥', 6);
return false;
}
if(!card_pass_reg.test(this.formInfo.pwdforsearch1)) {
this.normalTips('亲,取卡密码由6~20数字、26个英文字母或者下划线组成😥😥', 6);
return false;
}
} else {
if(this.formInfo.pwdforsearch2) {
if(!card_pass_reg.test(this.formInfo.pwdforsearch2)) {
this.normalTips('亲,取卡密码由6~20数字、26个英文字母或者下划线组成😥😥', 6);
return false;
}
}
}
return true;
},
setCardStatus() {
// 设置会员卡状态
var that = this;
if(!that.is_login || !that.goodsInfo) return false;
for (var index in that.alreadyBuy) {
that.alreadyBuy[index]['status'] = true;
var card = that.alreadyBuy[index];
var rate = parseFloat(card.rate);
rate = (100 - rate) * 0.01;
var rate_money = ((rate > 0 ? rate : 0) * parseFloat(that.goodsInfo.price)).toFixed(2)
var price_diff = parseFloat(that.goodsInfo.price) - parseFloat(that.goodsInfo.cost_price)
if(rate_money <= 0 || rate_money >= price_diff) {
that.alreadyBuy[index]['status'] = false;
}
}
},
checkCard(card_id, index) {
if(this.is_yh) {
this.normalTips('已使用优惠券,无法使用会员卡😥😥');
return false;
}
if(!this.alreadyBuy[index].status) {
this.normalTips('该会员卡不满足使用条件😥😥')
return false;
}
if(this.formInfo.vip_card_id === card_id) {
this.formInfo.vip_card_id = '';
} else {
this.formInfo.vip_card_id = card_id;
this.formInfo.couponcode = '';
}
this.getTotalPrice();
},
toQueryString(obj) {
var urlParamsStr = ""
var index = 0;
for (var key in obj) {
urlParamsStr += (index === 0 ? '?' : '&') + key + "=" + obj[key]
index = 1;
}
return urlParamsStr
},
normalTips(msg, time = 3, title = '温馨提示') {
this.$Notice.warning({
title: title,
duration: time,
render: h => {
return h('span', [
msg
])
}
});
},
errorTips(msg = '哎呀!遇到问题了😥😥,请稍后再试!', time = 3, title = '温馨提示') {
this.$Notice.error({
title: title,
duration: time,
render: h => {
return h('span', [msg])
}
});
},
timeToDate(times) {
var time = new Date(times*1000);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
return y + '-' + add0(m) + '-' + add0(d)+' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
},
goodsNumChange() {
var goods_num = parseInt(this.formInfo.quantity);
if(isNaN(goods_num) || goods_num <= 1) {
this.errorTips('请选择输入购买数量');
return false;
}
if(goods_num < this.goodsInfo.limit_quantity) {
this.errorTips('商品最少购买' + goods_num + '件!');
return false;
}
this.getTotalPrice();
},
pay() {
var that = this;
that.balance_visible = false;
// boolean to int
that.formInfo.is_rev_sms = that.formInfo.is_rev_sms ? 1 : 0;
that.formInfo.isemail = that.formInfo.isemail ? 1 : 0;
if(!that.formInfo.goods_id) {
that.normalTips('亲,请选择您要购买的商品😙😙')
return false;
}
if(!that.checkContact()) return false;
if(!that.checkEmail()) return false;
if(!that.checkTakPss()) return false;
if(that.is_yh && !that.formInfo.couponcode) {
that.normalTips('亲,请填写您的优惠券码😙😙')
$('[name="couponcode"]').focus();
return false;
}
that.formInfo.goodid = that.formInfo.goods_id;
// 发起支付
var index = layer.open({
type: 2,
shade: 0.1,
title: false,
area: ['700px', '450px'],
content: '/pay/order' + that.toQueryString(that.formInfo),
});
setTimeout(function () {
that.formInfo.pay_password = '';
}, 100)
}
}
})
-->