|
|
@@ -57,7 +57,7 @@ import AppShareMask from "@/components/module/app-share-mask";
|
|
|
import { share } from "@/mixins";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import { getGhsProductDetail } from "@/api/product";
|
|
|
-import { ghsInfo,getGhsDataApi } from "@/api/ghs/index";
|
|
|
+import { ghsInfo,getGhsDataApi } from "@/api/ghs";
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
export default {
|
|
|
name: "detail",
|
|
|
@@ -94,64 +94,61 @@ export default {
|
|
|
this.$util.pageTo({url:"/admin/billing/affirmGhs?id="+this.option.ghsId,type:2})
|
|
|
},
|
|
|
init() {
|
|
|
- let that = this
|
|
|
-
|
|
|
- let ghsShopAdminId = this.option.ghsShopAdminId ? this.option.ghsShopAdminId : 0
|
|
|
-
|
|
|
+ let that = this
|
|
|
+ //扫码进来
|
|
|
+ if(this.option.scene){
|
|
|
+ const scene = decodeURIComponent(this.option.scene);
|
|
|
+ var sceneItem = scene.split("&");
|
|
|
+ var arr, name, value;
|
|
|
+ var sceneArray = new Array();
|
|
|
+ for (var i = 0, l = sceneItem.length; i < l; i++) {
|
|
|
+ arr = sceneItem[i].split("=");
|
|
|
+ name = arr[0];
|
|
|
+ value = arr[1];
|
|
|
+ sceneArray[name] = value;
|
|
|
+ }
|
|
|
+ let id = sceneArray.id ? sceneArray.id : 0
|
|
|
+ let shopId = sceneArray.sId ? sceneArray.sId : 0
|
|
|
+ if(Number(id)>0 && Number(shopId)>0){
|
|
|
+ ghsInfo({shopId: shopId}).then(res => {
|
|
|
+ let ghsId = res.data.id
|
|
|
+ that.option.ghsId = ghsId
|
|
|
+ that.productDetail(id)
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ that.$msg('二维码有问题')
|
|
|
+ }
|
|
|
+ }else{
|
|
|
if(this.option.ghsId){
|
|
|
this.isShare = false
|
|
|
getGhsDataApi({id: this.option.ghsId}).then(res => {
|
|
|
-
|
|
|
- let shopId = res.data.shopId
|
|
|
- let ghsId = this.option.ghsId
|
|
|
- that.productDetail(ghsId,ghsShopAdminId,shopId)
|
|
|
-
|
|
|
- }).catch(err => {})
|
|
|
-
|
|
|
+ that.productDetail(this.option.id)
|
|
|
+ })
|
|
|
}else{
|
|
|
-
|
|
|
ghsInfo({shopId: this.option.shopId}).then(res => {
|
|
|
let ghsId = res.data.id;
|
|
|
- let shopId = this.option.shopId
|
|
|
- that.productDetail(ghsId,ghsShopAdminId,shopId)
|
|
|
- }).catch(err => {})
|
|
|
-
|
|
|
+ that.option.ghsId = ghsId
|
|
|
+ that.productDetail(this.option.id)
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
+ }
|
|
|
},
|
|
|
- productDetail(ghsId,ghsShopAdminId,shopId){
|
|
|
- let that = this
|
|
|
- getGhsProductDetail({ id: this.option.id,ghsId:ghsId }).then(res => {
|
|
|
- if (!this.$util.isEmpty(res.data)){
|
|
|
+ productDetail(id){
|
|
|
+ getGhsProductDetail({ id: id}).then(res => {
|
|
|
+ if (!this.$util.isEmpty(res.data)){
|
|
|
|
|
|
- this.productInfo = res.data
|
|
|
+ this.productInfo = res.data
|
|
|
|
|
|
- let newArr = [];
|
|
|
- newArr.push({img: res.data.bigCover});
|
|
|
- this.imgList = newArr;
|
|
|
+ let newArr = [];
|
|
|
+ newArr.push({img: res.data.bigCover});
|
|
|
+ this.imgList = newArr;
|
|
|
|
|
|
- let title = res.data.name+' ¥'+res.data.price
|
|
|
- if(res.data.discountPrice > 0){
|
|
|
- title = '【特价】'+title
|
|
|
- }
|
|
|
- let shareParams = {
|
|
|
- title: title,
|
|
|
- desc: res.data.price,
|
|
|
- imgUrl: res.data.bigCover,
|
|
|
- pagePath: `pagesPurchase/ghsProduct?hdShopAdminId=${that.loginInfo.shopAdminId}&ghsShopAdminId=${ghsShopAdminId}&shopId=${shopId}&id=0`
|
|
|
- };
|
|
|
- that.jweixinFn(shareParams);
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
changeNum(e) {
|
|
|
this.buyNum = e.value;
|
|
|
},
|
|
|
- goToShop(){
|
|
|
- let account = uni.getStorageSync('account')
|
|
|
- this.$util.pageTo({url: '/pages/home/shop',type: 4,query: {account: account}})
|
|
|
- },
|
|
|
showPopup() {
|
|
|
this.popupShow = true
|
|
|
},
|