Explorar o código

详情页优化

shish %!s(int64=3) %!d(string=hai) anos
pai
achega
e53b6d1e10

+ 1 - 4
hdApp/src/admin/ghsProduct/detail.vue

@@ -80,8 +80,7 @@ export default {
       showShare: false,
       isShare:true,
       pageType: "cg",
-      notOpenShop:true,
-      currentId:0
+      notOpenShop:true
     };
   },
   onLoad(option) {},
@@ -124,7 +123,6 @@ export default {
 				}
         let id = sceneArray.id ? sceneArray.id : 0
         let shopId = sceneArray.sId ? sceneArray.sId : 0
-        that.currentId = id
         if(Number(id)>0 && Number(shopId)>0){
           ghsInfo({shopId: shopId}).then(res => {
             let ghsId = res.data.id
@@ -135,7 +133,6 @@ export default {
           that.$msg('二维码有问题')
         }
 			}else{
-        that.currentId = this.option.id
         if(this.option.ghsId){
           this.isShare = false
           getGhsDataApi({id: this.option.ghsId}).then(res => {

+ 5 - 48
hdApp/src/pagesPurchase/details.vue

@@ -6,17 +6,8 @@
 				<view class="module-com">
 					<view class="commodity-view">
 						<view class="commodity-list">
-							<view
-								class="commodity-item"
-								v-for="(item, index) in selectList"
-								:key="index"
-							>
-								<image
-									class="item-icon"
-									:src="item.itemCover || item.cover"
-									alt="商品图"
-								/>
-
+							<view class="commodity-item" v-for="(item, index) in selectList" :key="index" >
+								<image class="item-icon" :src="item.itemCover || item.cover" alt="商品图" />
 								<view class="item-info">
 									<view class="info-line">
 										<text class="item-name">{{ item.itemName }}</text>
@@ -31,9 +22,7 @@
 									<view class="info-line">
 										<text class="item-type">b级</text>
 										<text class="item-count">
-											<text v-if="item.bigCount > 0 || item.smallCount > 0">{{
-												`${item.bigCount}`
-											}}</text>
+											<text v-if="item.bigCount > 0 || item.smallCount > 0">{{ `${item.bigCount}` }}</text>
 											<text v-if="item.smallCount > 0">/</text>
 											<text v-if="item.smallCount > 0">{{ `${item.smallCount}` }}</text>
 										</text>
@@ -54,31 +43,13 @@
 						</view>
 					</view>
 				</view>
-				<!-- <view class="prompt-text">注: 请先关注公众号,绑定后可以在移动端自动登录</view> -->
-
 				<view class="module-com input-line-wrap">
 					<tui-list-cell class="line-cell" :hover="false" :arrow="false">
 						<view class="tui-title ">供应商</view>
 						<text>
 							{{ detailsInfo.supplierName || "" }}
-							<!-- 欠款:91658.00  -->
 						</text>
 					</tui-list-cell>
-					<!-- <tui-list-cell class="line-cell" :hover="false">
-						<view class="tui-title "></view>
-
-						<view class="tag-list">
-							<view class="tag-item">
-								盛丰
-							</view>
-							<view class="tag-item">
-								盛丰
-							</view>
-							<view class="tag-item">
-								盛丰
-							</view>
-						</view>
-					</tui-list-cell> -->
 				</view>
 				<view class="module-com input-line-wrap">
 					<tui-list-cell class="line-cell" :hover="false">
@@ -138,11 +109,6 @@
 					</tui-list-cell>
 					<tui-list-cell class="line-cell" :hover="false" :arrow="true">
 						<view class="tui-title ">入库日期</view>
-						<!-- <view class="tui-input" v-if="form.province || form.city">
-							{{ form.province + "-" + form.city }}
-						</view> -->
-						<!-- <view class="tui-placeholder" v-else>请选择</view>
-						<input v-model="form.province" name="province" hidden /> -->
 						<AppDatePicker
 							v-if="canIEdit"
 							:dateVal="form.entryTime"
@@ -179,11 +145,7 @@
 		</view>
 
 		<!-- 选择客户 -->
-		<AppCustomerSel
-			:show.sync="showCustomer"
-			@change="changeCustomerFn"
-			:city="form.customer"
-		/>
+		<AppCustomerSel :show.sync="showCustomer" @change="changeCustomerFn" :city="form.customer" />
 	</view>
 </template>
 
@@ -194,14 +156,9 @@ import AppAvatarModule from "@/components/module/app-avatar";
 import AppCustomerSel from "@/components/app-customer-sel";
 const form = require("@/utils/formValidation.js");
 import productMins from "@/mixins/product";
-import {
-	getPurchaseDetailApi,
-	createPurchaseOrderApi
-} from "@/api/purchase/index";
+import { getPurchaseDetailApi, createPurchaseOrderApi } from "@/api/purchase/index";
 import { PURCHASE_ORDER_STATUS } from "@/utils/declare";
-
 import AppDatePicker from "@/components/app-date-picker";
-
 export default {
 	// 采购详情
 	components: {

+ 4 - 0
mallApp/src/api/hd/index.js

@@ -3,3 +3,7 @@ import https from '@/plugins/luch-request_0.0.7/request'
 export const getList = data => {
 	return https.get('/hd/list', data)
 }
+
+export const getHdInfo = data => {
+	return https.get('/hd/info', data)
+}

+ 1 - 6
mallApp/src/mixins/cgProduct.js

@@ -7,10 +7,8 @@ export default {
 		return {
 			options:'',
 			pageType: "bill", //选择商品页面类别  用于区分不同功能的数据
-
 			suitInfo: [], //成品-商品信息
 			suitClassIndex: 0, //成品-当前商品类别下标
-
 			productInfo: [], //商品信息
 			pxClassInfo: [], //培训班开单列表
 			classIndex: 0, //当前商品类别下标
@@ -42,14 +40,11 @@ export default {
 				title: name
 			});
 		}
-
 		if (this.autoLoad) {
 			this.initData();
-
 			if(this.isGhsProduct){
-				// this.initGhsData(id,shopId);//采购-进店下单
+				//this.initGhsData(id,shopId)
 			}else{
-				console.log(222)
 				if(!this.$util.isEmpty(this.tabIndex)){
 					this.initData();//组合
 				}

+ 79 - 24
mallApp/src/pages/item/detail.vue

@@ -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() {

+ 1 - 1
mallApp/src/pages/login/index.vue

@@ -11,7 +11,7 @@
           <tui-list-cell class="line-cell" :hover="false">
             <view class="tui-title" style="width:120upx;">手机号</view>
             <view style="width:400upx;verticle-align:middle">
-              <button class="admin-button-com blue mini-btn" style="border:none;" open-type="getPhoneNumber" @getphonenumber="getWxMobile" >点击自动填写</button>
+              <button class="admin-button-com blue middle" style="border:none;" open-type="getPhoneNumber" @getphonenumber="getWxMobile" >点击自动填写</button>
               <text style="margin-left:5upx;">{{form.mobile}}</text>
             </view>
           </tui-list-cell>