|
|
@@ -43,7 +43,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
<sel-popup :show="popupShow" :info="data" :buyNum="buyNum" @change="changeNum" @close="hidePopup" @nextFn="nextFn" />
|
|
|
- <buy-foot @buy="showPopup" @goShop="goToShop" :stock="data.stock" />
|
|
|
+ <buy-foot @buy="showPopup" :stock="data.stock" />
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -57,6 +57,7 @@ import GoLogin from "@/pages/home/components/go-login.vue";
|
|
|
import { share } from "@/mixins";
|
|
|
import { mapGetters } from "vuex";
|
|
|
import { getMallItemInfo } from "@/api/item";
|
|
|
+import { getHdInfo } from "@/api/hd";
|
|
|
import productMins from "@/mixins/cgProduct";
|
|
|
export default {
|
|
|
name: "detail",
|
|
|
@@ -78,13 +79,30 @@ export default {
|
|
|
popupShow: false,
|
|
|
loginShow: false,
|
|
|
showShare: false,
|
|
|
- pageType: "cg"
|
|
|
+ pageType: "cg",
|
|
|
+ autoLoad:false,
|
|
|
+ //0没有登录 1有登录
|
|
|
+ loginStyle :0
|
|
|
};
|
|
|
},
|
|
|
- onLoad(option) {},
|
|
|
- mounted() {},
|
|
|
+ watch: {
|
|
|
+ loginInfo(newVal) {
|
|
|
+ if(!this.$util.isEmpty(newVal)){
|
|
|
+ this.loginStyle = 1
|
|
|
+ }else{
|
|
|
+ this.loginStyle = 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow () {
|
|
|
+ if(!this.$util.isEmpty(this.loginInfo)){
|
|
|
+ this.loginStyle = 1
|
|
|
+ }else{
|
|
|
+ this.loginStyle = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
computed: {
|
|
|
- ...mapGetters({ shopUser: "getShopUser" })
|
|
|
+ ...mapGetters({ shopUser: "getShopUser",loginInfo:"getLoginInfo" })
|
|
|
},
|
|
|
methods: {
|
|
|
nextFn(num){
|
|
|
@@ -93,31 +111,68 @@ export default {
|
|
|
this.$util.pageTo({url:"/pages/billing/affirmGhs?account="+this.option.account,type:2})
|
|
|
},
|
|
|
init() {
|
|
|
- this.getItemInfo()
|
|
|
- },
|
|
|
- async getItemInfo() {
|
|
|
- let id = this.option.id ? this.option.id : 0
|
|
|
- let hdId = this.option.hdId ? this.option.hdId : 0
|
|
|
- await getMallItemInfo({ id: id,hdId:hdId}).then(res => {
|
|
|
- if (this.$util.isEmpty(res.data)){
|
|
|
- return false
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ console.log(sceneArray)
|
|
|
+ let id = sceneArray.id ? sceneArray.id : 0
|
|
|
+ let account = sceneArray.a ? sceneArray.a : 0
|
|
|
+ this.option.account = account
|
|
|
+ if(Number(id)>0 && Number(account)>0){
|
|
|
+ uni.setStorageSync('account',account)
|
|
|
+ getHdInfo().then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.getItemDetail(id)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ that.$msg('二维码错误')
|
|
|
}
|
|
|
- this.data = res.data.info ? res.data.info : {}
|
|
|
-
|
|
|
- let newArr = [];
|
|
|
- newArr.push({img: this.data.bigCover});
|
|
|
- this.imgList = newArr;
|
|
|
-
|
|
|
- })
|
|
|
+ }else{
|
|
|
+ let id = this.option.id ? this.option.id : 0
|
|
|
+ //let account = this.option.account ? this.option.account : 0
|
|
|
+ that.getItemDetail(id)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getItemDetail(id){
|
|
|
+ getMallItemInfo({id: id}).then(res => {
|
|
|
+ if (this.$util.isEmpty(res.data)){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.data = res.data.info ? res.data.info : {}
|
|
|
+ let newArr = [];
|
|
|
+ newArr.push({img: this.data.bigCover});
|
|
|
+ this.imgList = newArr;
|
|
|
+ })
|
|
|
},
|
|
|
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() {
|
|
|
+ if(this.loginStyle == 0){
|
|
|
+ let that = this
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请先注册登录哦',
|
|
|
+ confirmText: "好的",
|
|
|
+ success: function(res) {
|
|
|
+ if (res.confirm) {
|
|
|
+ that.pageTo({url:'/pages/login/index',type:2})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return false;
|
|
|
+ }
|
|
|
this.popupShow = true
|
|
|
},
|
|
|
hidePopup() {
|