|
|
|
@ -197,16 +197,16 @@ import {
|
|
|
|
|
getProductDetail, |
|
|
|
|
postCartAdd, |
|
|
|
|
getCartCount, |
|
|
|
|
getProductCode |
|
|
|
|
getProductCode, |
|
|
|
|
} from "@/api/store"; |
|
|
|
|
import { |
|
|
|
|
getCoupon, |
|
|
|
|
getCollectAdd, |
|
|
|
|
getCollectDel, |
|
|
|
|
getUserInfo |
|
|
|
|
getUserInfo, |
|
|
|
|
} from "@/api/user"; |
|
|
|
|
import { isWeixin, PosterCanvas, handleQrCode } from "@/utils"; |
|
|
|
|
// import { wechatEvevt } from "@/libs/wechat"; |
|
|
|
|
import { wechatEvevt } from "@/libs/wechat"; |
|
|
|
|
import { imageBase64 } from "@/api/public"; |
|
|
|
|
import { mapGetters } from "vuex"; |
|
|
|
|
|
|
|
|
@ -220,7 +220,7 @@ export default {
|
|
|
|
|
CouponPop, |
|
|
|
|
ProductWindow, |
|
|
|
|
StorePoster, |
|
|
|
|
ShareInfo |
|
|
|
|
ShareInfo, |
|
|
|
|
}, |
|
|
|
|
data: function () { |
|
|
|
|
return { |
|
|
|
@ -232,18 +232,18 @@ export default {
|
|
|
|
|
image: "", |
|
|
|
|
title: "", |
|
|
|
|
price: "", |
|
|
|
|
code: "" |
|
|
|
|
code: "", |
|
|
|
|
}, |
|
|
|
|
posterImageStatus: false, |
|
|
|
|
animated: false, |
|
|
|
|
coupon: { |
|
|
|
|
coupon: false, |
|
|
|
|
list: [] |
|
|
|
|
list: [], |
|
|
|
|
}, |
|
|
|
|
attr: { |
|
|
|
|
cartAttr: false, |
|
|
|
|
productAttr: [], |
|
|
|
|
productSelect: {} |
|
|
|
|
productSelect: {}, |
|
|
|
|
}, |
|
|
|
|
isOpen: false, //是否打开属性组件 |
|
|
|
|
productValue: [], |
|
|
|
@ -263,19 +263,19 @@ export default {
|
|
|
|
|
swiperRecommend: { |
|
|
|
|
pagination: { |
|
|
|
|
el: ".swiper-pagination", |
|
|
|
|
clickable: true |
|
|
|
|
clickable: true, |
|
|
|
|
}, |
|
|
|
|
autoplay: false, |
|
|
|
|
loop: false, |
|
|
|
|
speed: 1000, |
|
|
|
|
observer: true, |
|
|
|
|
observeParents: true |
|
|
|
|
observeParents: true, |
|
|
|
|
}, |
|
|
|
|
goodList: [], |
|
|
|
|
systemStore: {}, |
|
|
|
|
qqmapsdk: null, |
|
|
|
|
productConClass: "product-con", |
|
|
|
|
tempName: "全国包邮" |
|
|
|
|
tempName: "全国包邮", |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
computed: mapGetters(["isLogin", "location"]), |
|
|
|
@ -287,6 +287,7 @@ export default {
|
|
|
|
|
this.id = this._route.query.id; |
|
|
|
|
} |
|
|
|
|
this.productCon(); |
|
|
|
|
this.setOpenShare(); |
|
|
|
|
}, |
|
|
|
|
watch: { |
|
|
|
|
posterImageStatus(status) { |
|
|
|
@ -296,7 +297,7 @@ export default {
|
|
|
|
|
} else { |
|
|
|
|
this.productConClass = "product-con"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
goShoppingCart() { |
|
|
|
@ -304,26 +305,26 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
goCustomerList() { |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
path: "/pages/user/CustomerList/index" |
|
|
|
|
path: "/pages/user/CustomerList/index", |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
goStoreList() { |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
path: "/pages/shop/StoreList/index" |
|
|
|
|
path: "/pages/shop/StoreList/index", |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
goEvaluateList(id) { |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
path: "/pages/shop/EvaluateList/index", |
|
|
|
|
query: { |
|
|
|
|
id |
|
|
|
|
} |
|
|
|
|
id, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
showChang: function (data) { |
|
|
|
|
this.$yrouter.push({ |
|
|
|
|
path: "/pages/map/index", |
|
|
|
|
query: data |
|
|
|
|
query: data, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
updateTitle() { |
|
|
|
@ -335,7 +336,7 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
shareCode: function () { |
|
|
|
|
var that = this; |
|
|
|
|
getProductCode(that.id).then(res => { |
|
|
|
|
getProductCode(that.id).then((res) => { |
|
|
|
|
that.posterData.code = res.data.code; |
|
|
|
|
that.listenerActionSheet(); |
|
|
|
|
}); |
|
|
|
@ -353,7 +354,7 @@ export default {
|
|
|
|
|
} |
|
|
|
|
uni.showLoading({ title: "加载中", mask: true }); |
|
|
|
|
getProductDetail(that.id, from) |
|
|
|
|
.then(res => { |
|
|
|
|
.then((res) => { |
|
|
|
|
res.data.storeInfo.description = res.data.storeInfo.description.replace( |
|
|
|
|
/\<img/gi, |
|
|
|
|
'<img style="max-width:100%;height:auto;"' |
|
|
|
@ -385,7 +386,7 @@ export default {
|
|
|
|
|
var list = good_list.slice(i * 6, 6); |
|
|
|
|
if (list.length) |
|
|
|
|
goodArray.push({ |
|
|
|
|
list: list |
|
|
|
|
list: list, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
that.mapKay = res.data.mapKay; |
|
|
|
@ -394,12 +395,12 @@ export default {
|
|
|
|
|
that.DefaultSelect(); |
|
|
|
|
that.getCartCount(); |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
.catch((err) => { |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: |
|
|
|
|
err.msg || err.response.data.msg || err.response.data.message, |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
duration: 2000, |
|
|
|
|
}); |
|
|
|
|
}) |
|
|
|
|
.finally(() => { |
|
|
|
@ -521,9 +522,9 @@ export default {
|
|
|
|
|
let that = this, |
|
|
|
|
q = { |
|
|
|
|
page: 1, |
|
|
|
|
limit: 20 |
|
|
|
|
limit: 20, |
|
|
|
|
}; |
|
|
|
|
getCoupon(q).then(res => { |
|
|
|
|
getCoupon(q).then((res) => { |
|
|
|
|
that.$set(that, "couponList", res.data || []); |
|
|
|
|
that.$set(that.coupon, "list", res.data); |
|
|
|
|
}); |
|
|
|
@ -607,7 +608,7 @@ export default {
|
|
|
|
|
uni.showToast({ |
|
|
|
|
title: "产品库存不足,请选择其它", |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
duration: 2000, |
|
|
|
|
}); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -618,7 +619,7 @@ export default {
|
|
|
|
|
uniqueId: |
|
|
|
|
that.attr.productSelect !== undefined |
|
|
|
|
? that.attr.productSelect.unique |
|
|
|
|
: "" |
|
|
|
|
: "", |
|
|
|
|
}; |
|
|
|
|
postCartAdd(q) |
|
|
|
|
.then(function (res) { |
|
|
|
@ -628,8 +629,8 @@ export default {
|
|
|
|
|
that.$yrouter.push({ |
|
|
|
|
path: "/pages/order/OrderSubmission/index", |
|
|
|
|
query: { |
|
|
|
|
id: res.data.cartId |
|
|
|
|
} |
|
|
|
|
id: res.data.cartId, |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
uni.showToast({ |
|
|
|
@ -638,16 +639,16 @@ export default {
|
|
|
|
|
duration: 2000, |
|
|
|
|
complete: () => { |
|
|
|
|
that.getCartCount(true); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(error => { |
|
|
|
|
.catch((error) => { |
|
|
|
|
that.isOpen = false; |
|
|
|
|
uni.showToast({ |
|
|
|
|
title: error.response.data.msg, |
|
|
|
|
icon: "none", |
|
|
|
|
duration: 2000 |
|
|
|
|
duration: 2000, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
@ -657,8 +658,8 @@ export default {
|
|
|
|
|
const isLogin = that.isLogin; |
|
|
|
|
if (isLogin) { |
|
|
|
|
getCartCount({ |
|
|
|
|
numType: 0 |
|
|
|
|
}).then(res => { |
|
|
|
|
numType: 0, |
|
|
|
|
}).then((res) => { |
|
|
|
|
that.CartCount = res.data.count; |
|
|
|
|
//加入购物车后重置属性 |
|
|
|
|
if (isAnima) { |
|
|
|
@ -683,8 +684,63 @@ export default {
|
|
|
|
|
}, |
|
|
|
|
listenerActionClose: function () { |
|
|
|
|
this.posters = false; |
|
|
|
|
}, |
|
|
|
|
setOpenShare: function () { |
|
|
|
|
var data = this.storeInfo; |
|
|
|
|
var href = location.href; |
|
|
|
|
if (this.$deviceType == "weixin") { |
|
|
|
|
if (this.isLogin) { |
|
|
|
|
getUserInfo().then((res) => { |
|
|
|
|
href = |
|
|
|
|
href.indexOf("?") === -1 |
|
|
|
|
? href + "?spread=" + res.data.uid |
|
|
|
|
: href + "&spread=" + res.data.uid; |
|
|
|
|
var configAppMessage = { |
|
|
|
|
desc: data.storeInfo, |
|
|
|
|
title: data.storeName, |
|
|
|
|
link: href, |
|
|
|
|
imgUrl: data.image, |
|
|
|
|
}; |
|
|
|
|
wechatEvevt( |
|
|
|
|
["updateAppMessageShareData", "updateTimelineShareData"], |
|
|
|
|
configAppMessage |
|
|
|
|
) |
|
|
|
|
.then((res) => { |
|
|
|
|
console.log(res); |
|
|
|
|
}) |
|
|
|
|
.catch((res) => { |
|
|
|
|
console.log(res); |
|
|
|
|
if (res.is_ready) { |
|
|
|
|
res.wx.updateAppMessageShareData(configAppMessage); |
|
|
|
|
res.wx.updateTimelineShareData(configAppMessage); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
var configAppMessage = { |
|
|
|
|
desc: data.storeInfo, |
|
|
|
|
title: data.storeName, |
|
|
|
|
link: href, |
|
|
|
|
imgUrl: data.image, |
|
|
|
|
}; |
|
|
|
|
wechatEvevt( |
|
|
|
|
["updateAppMessageShareData", "updateTimelineShareData"], |
|
|
|
|
configAppMessage |
|
|
|
|
) |
|
|
|
|
.then((res) => { |
|
|
|
|
console.log(res); |
|
|
|
|
}) |
|
|
|
|
.catch((res) => { |
|
|
|
|
console.log(res); |
|
|
|
|
if (res.is_ready) { |
|
|
|
|
res.wx.updateAppMessageShareData(configAppMessage); |
|
|
|
|
res.wx.updateTimelineShareData(configAppMessage); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|