Forráskód Böngészése

云仓库存显示

liyuan 1 hete
szülő
commit
1646215865
3 módosított fájl, 146 hozzáadás és 63 törlés
  1. 15 0
      api/tabBar/homeNew.js
  2. 68 36
      pages/tabBar/home.vue
  3. 63 27
      pages/views/buyGoods/commodityDetails.vue

+ 15 - 0
api/tabBar/homeNew.js

@@ -118,3 +118,18 @@ export const isProcurement = (data) => {
 		params: data
 	})
 }
+
+
+export const getGoodsDetailStockByCloud = (id) => {
+	return http.request({
+		url: '/blade-sales-part/shoppingmalldetail/getGoodsDetailStockByCloud?id=' + id,
+		method: 'GET'
+	})
+}
+
+export function appDetailCloud(id) {
+	return http.request({
+		url: '/blade-sales-part/shoppingmalldetail/getGoodsDetailByCloud?id=' + id,
+		method: 'GET'
+	})
+}

+ 68 - 36
pages/tabBar/home.vue

@@ -121,6 +121,7 @@
 	import {
 		activityList
 	} from '@/api/tabBar/activity.js'
+  import {cloudWarehouseList} from '@/api/tabBar/classification.js'
 	export default {
 		data() {
 			return {
@@ -185,6 +186,7 @@
 				phoneNumber: '', // 业务员联系电话
 				salesmanShow: false, // 联系业务员弹窗
 				userInfo: {}, // 当前用户数据
+        cloudWarehouse: 0
 			}
 		},
 		onPageScroll(e) {
@@ -207,6 +209,7 @@
 			}
 		},
 		onLoad(e) {
+      this.getIsCloud()
 			isProcurement({
 				"param": "whether.open.share"
 			}).then(res => {
@@ -309,6 +312,7 @@
 			uni.hideLoading();
 		},
 		onShow() {
+      this.getIsCloud()
 			this.getUpdate()
 			activityList({
 				current: 1,
@@ -350,6 +354,14 @@
 			})
 		},
 		methods: {
+      getIsCloud(){
+        isProcurement({
+          "param": "cloud_warehouse"
+        }).then(res => {
+          console.info('res-----', res)
+          this.cloudWarehouse = res.data
+        })
+      },
 			getUpdate() {
 				const updateManager = uni.getUpdateManager();
 				updateManager.onCheckForUpdate(function(res) {
@@ -536,41 +548,61 @@
 				if (this.explosionProof) {
 					obj.explosionProof = 1
 				}
-				if (uni.getStorageSync('whether_openShare') == 1) {
-					appListNew({
-						size: this.page.size,
-						current: this.page.current,
-						...obj,
-						...this.search,
-						whetherIntegral: 0
-					}).then(res => {
-						this.dataList = this.dataList.concat(res.data.records)
-						this.page.total = res.data.total
-						if (this.dataList.length == res.data.total) {
-							this.status = 'nomore'
-						}
-						uni.hideLoading();
-					}).catch(err => {
-						uni.hideLoading();
-					})
-				} else {
-					appList({
-						size: this.page.size,
-						current: this.page.current,
-						...obj,
-						...this.search,
-						whetherIntegral: 0
-					}).then(res => {
-						this.dataList = this.dataList.concat(res.data.records)
-						this.page.total = res.data.total
-						if (this.dataList.length == res.data.total) {
-							this.status = 'nomore'
-						}
-						uni.hideLoading();
-					}).catch(err => {
-						uni.hideLoading();
-					})
-				}
+        if (this.cloudWarehouse == 1) {
+          cloudWarehouseList({
+            size: this.page.size,
+            current: this.page.current,
+            ...obj,
+            ...this.search,
+            whetherIntegral: 0
+          }).then(res => {
+            this.dataList = this.dataList.concat(res.data.records)
+            this.page.total = res.data.total
+            if (this.dataList.length == res.data.total) {
+              this.status = 'nomore'
+            }
+            uni.hideLoading();
+          }).catch(err => {
+            uni.hideLoading();
+          })
+        } else {
+          if (uni.getStorageSync('whether_openShare') == 1) {
+            appListNew({
+              size: this.page.size,
+              current: this.page.current,
+              ...obj,
+              ...this.search,
+              whetherIntegral: 0
+            }).then(res => {
+              this.dataList = this.dataList.concat(res.data.records)
+              this.page.total = res.data.total
+              if (this.dataList.length == res.data.total) {
+                this.status = 'nomore'
+              }
+              uni.hideLoading();
+            }).catch(err => {
+              uni.hideLoading();
+            })
+          } else {
+            appList({
+              size: this.page.size,
+              current: this.page.current,
+              ...obj,
+              ...this.search,
+              whetherIntegral: 0
+            }).then(res => {
+              this.dataList = this.dataList.concat(res.data.records)
+              this.page.total = res.data.total
+              if (this.dataList.length == res.data.total) {
+                this.status = 'nomore'
+              }
+              uni.hideLoading();
+            }).catch(err => {
+              uni.hideLoading();
+            })
+          }
+        }
+
 
 			},
 			close() {
@@ -756,4 +788,4 @@
 		top: 16rpx;
 		right: 36rpx;
 	}
-</style>
+</style>

+ 63 - 27
pages/views/buyGoods/commodityDetails.vue

@@ -144,11 +144,12 @@
 		appDetailNew,
 		addToCart,
 		appModifyPrice,
-		stockDescList,
 		stockDescListV1,
 		listShareV1,
-		isProcurement
+    getGoodsDetailStockByCloud,
+    appDetailCloud,
 	} from '@/api/tabBar/homeNew.js'
+  import {isProcurement} from '@/api/tabBar/shoppingCart.js'
 	export default {
 		data() {
 			return {
@@ -172,36 +173,71 @@
 				// 审核状态
 				checkStatus: '',
 				adminShow: false,
+        cloudWarehouse: 0
 			}
 		},
 		onLoad(onLoad) {
-			this.checkStatus = uni.getStorageSync('checkStatus');
-			if (uni.getStorageSync('whether_openShare') == 1) {
-				appDetailNew(onLoad).then(res => {
-					this.dataForm = res.data
-					if (res.data.type == 0) {
-						this.form = res.data.thisLocality
-					} else {
-						this.form = res.data.offsite
-					}
-					this.form.goodsNum = Number(this.form.goodsNum)
-					this.stockDescListfun()
-				})
-			} else {
-				appDetail(onLoad).then(res => {
-					this.dataForm = res.data
-					if (res.data.type == 0) {
-						this.form = res.data.thisLocality
-					} else {
-						this.form = res.data.offsite
-					}
-					this.form.goodsNum = Number(this.form.goodsNum)
-					this.stockDescListfun()
-				})
-			}
+      isProcurement({
+        "param": "cloud_warehouse"
+      }).then(res => {
+        this.cloudWarehouse = res.data ? Number(res.data) : 0
+        if (this.cloudWarehouse === 1) {
+          this.getCloudAppDetail(onLoad.id)
+        } else {
+          this.loadList(onLoad)
+        }
+      })
 
 		},
 		methods: {
+      loadList(onLoad){
+        this.checkStatus = uni.getStorageSync('checkStatus');
+        if (uni.getStorageSync('whether_openShare') == 1) {
+          appDetailNew(onLoad).then(res => {
+            this.dataForm = res.data
+            if (res.data.type == 0) {
+              this.form = res.data.thisLocality
+            } else {
+              this.form = res.data.offsite
+            }
+            this.form.goodsNum = Number(this.form.goodsNum)
+            this.stockDescListfun()
+          })
+        } else {
+          appDetail(onLoad).then(res => {
+            this.dataForm = res.data
+            if (res.data.type == 0) {
+              this.form = res.data.thisLocality
+            } else {
+              this.form = res.data.offsite
+            }
+            this.form.goodsNum = Number(this.form.goodsNum)
+            this.stockDescListfun()
+          })
+        }
+      },
+
+      loadByCloud(id) {
+        getGoodsDetailStockByCloud(id).then(res => {
+          this.inventoryData = res.data.weChatDetailStockVos
+          this.inventoryDataForm.storeInventory = res.data.storeInventory
+          this.inventoryDataForm.storeInventoryShare = res.data.storeInventoryShare
+        })
+      },
+
+      getCloudAppDetail(id){
+        appDetailCloud(id).then(res => {
+          this.dataForm = res.data
+          if (res.data.type == 0) {
+            this.form = res.data.thisLocality
+          } else {
+            this.form = res.data.offsite
+          }
+          this.form.goodsNum = Number(this.form.goodsNum)
+          this.loadByCloud(id)
+        })
+      },
+
 			previewImage() {
 				uni.previewImage({
 					current: 0, // 当前显示图片的索引,默认是0
@@ -379,4 +415,4 @@
 		font-size: 22rpx;
 		height: 28rpx;
 	}
-</style>
+</style>