Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(res) => {
console.log(res)
// alert(JSON.stringify(res))
if (res.err_msg == "get_brand_wcpay_request:ok") {
Toast(this.$t('wxpay.succ_toast'))
this.$router.push('/wxpay/done')
} else if (res.err_msg == "get_brand_wcpay_request:fail"){
Toast(this.$t('wxpay.error_toast', {msg: res.err_msg}))
}
this.loading = false
}
);
let goodsCount = {};
this.carts.forEach((item, index) => {
if (item.isCheck == true) {
checkedId.push(item.goods_id);
cartId.push(item.id);
// 多个商品
goodsCount[item.goods_id] = item.num;
}
});
checkedId = checkedId.join(",");
cartId = cartId.join(",");
if (checkedId == "") {
Toast("请选择购买的商品");
} else {
this.$router.push({name: `confirm_order`, params: {
type: 1,
goodsId: checkedId,
cartIds: cartId,
count: goodsCount
}})
}
},
delGoods () {
response => {
const res = response.data
if (res.code !== 200) {
// 90000002:登录超时
if (res.code === 90000002) {
store.dispatch('FedLogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
})
} else if (res.code === 10000007) { // 10000007:没有权限
Toast('没有权限,请重新登录!')
} else {
Toast(res.msg)
}
return Promise.reject('error')
} else {
return response.data
}
},
error => {
submitOrder() {
const _this = this;
let address = this.address;
let type = 0;
// 填写地址
if (!address.mobile) {
Toast("请填写你的地址");
return false;
}
// 同意协议
if (!this.isTcp) {
Toast("请同意协议");
return false;
}
// 配送门店
if (this.sendType.includes(2)) {
if (this.storesId == 0) {
Toast("请选择配送门店");
return false;
}
}
post("shop/api/add_order", {
address_id: _this.address.id,
remark: _this.remark, // 留言
sn_id: _this.snId, // 优惠卷id
stores_id: _this.storesId, // 门店id
jiesuan(){
//先判断用户是否有选中商品
var listid=[];
this.goods.forEach((car)=>{
if(car.check){
listid.push(car);
}
});
//判断listid的长度
if(listid.length==0){
Toast("请选择你要购买的商品")
}else{
this.$axios.post("/vue/jiesuangoods",{
listid,
goodsusername:localStorage.username
}).then(res=>{
// this.goods=res.data.result;
});
this.$router.push({name:"jiesuan"});
}
}
},
}).then(res => {
console.log(res);
if (res.data.errno === 0) {
Toast('修改成功 !')
this.$notify({
title: '成功',
message: '修改成功 !',
type: 'success'
});
this.getList()
this.closechangeprice()
loading.close()
}else{
Toast('修改失败 !')
this.$notify.error({
title: '错误',
message: '修改失败 !'
});
loading.close()
}
console.log(this.registerInfo)
this.$axios.post("/vue/register",this.registerInfo).then(res=>{
console.log(res.data);
if(!!res.data.type){
this.$router.push({name:'login'})
}
})
}else{
Toast('两次密码输入不一致');
}
}else{
Toast('密码应为6-12的字母和数字组合');
}
}else{
Toast('手机号不合法');
}
}else{
Toast('用户名应为6-12位字符或数字');
}
}else{
Toast('请输入用户名');
}
}
}
}).then(res => {
console.log(res);
if (res.data.errno === 0) {
Toast('修改成功 !')
this.$notify({
title: '成功',
message: '修改成功 !',
type: 'success'
});
this.getList()
this.closechangeprice()
loading.close()
}else{
Toast('修改失败 !')
this.$notify.error({
title: '错误',
message: '修改失败 !'
});
loading.close()
}
})
}).catch(() => {
onDelete() {
Toast('delete');
},
onChangeDetail(val) {
.then(res => {
if (res.data == 1) {
Toast("加入收藏成功");
this.isCollect = true;
} else {
Toast("取消收藏成功");
this.isCollect = false;
}
});
}