USER-20230908AJ\Administrator 2 rokov pred
rodič
commit
d559218e0d
4 zmenil súbory, kde vykonal 129 pridanie a 278 odobranie
  1. 1 184
      package-lock.json
  2. 108 82
      pages-takeout/shop-mod/menu.vue
  3. 17 9
      pages-takeout/shop.vue
  4. 3 3
      pages.json

+ 1 - 184
package-lock.json

@@ -1,189 +1,6 @@
 {
-  "name": "school_webUser",
-  "lockfileVersion": 2,
   "requires": true,
-  "packages": {
-    "": {
-      "dependencies": {
-        "js-base64": "3.7.2",
-        "jweixin-module": "^1.6.0",
-        "uni-read-pages": "1.0.5",
-        "uni-simple-router": "2.0.7",
-        "uniapp-qrcode": "^1.0.2",
-        "uploading-oss": "1.0.3",
-        "wecomjsdk": "1.0.2"
-      },
-      "devDependencies": {
-        "@types/html5plus": "1.0.2",
-        "@types/uni-app": "1.4.4",
-        "vue-waterfall-easy": "2.4.4"
-      }
-    },
-    "node_modules/@babel/parser": {
-      "version": "7.19.0",
-      "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.0.tgz",
-      "integrity": "sha512-74bEXKX2h+8rrfQUfsBfuZZHzsEs6Eql4pqy/T4Nn6Y9wNPggQOqD6z6pn5Bl8ZfysKouFZT/UXEH94ummEeQw==",
-      "dev": true,
-      "bin": {
-        "parser": "bin/babel-parser.js"
-      },
-      "engines": {
-        "node": ">=6.0.0"
-      }
-    },
-    "node_modules/@types/html5plus": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/@types/html5plus/-/html5plus-1.0.2.tgz",
-      "integrity": "sha512-OklP5lrmLq8/6TUOLgWc0LndUVvAiTWX5dnyoCFhIUtFW9opWsnCtG/UxPgeuC28Rv2XNbFfft/hEEI39P/4Ag==",
-      "dev": true
-    },
-    "node_modules/@types/uni-app": {
-      "version": "1.4.4",
-      "resolved": "https://registry.npmjs.org/@types/uni-app/-/uni-app-1.4.4.tgz",
-      "integrity": "sha512-ZTXnrCTblZyoLIoKbTv1Whz1nxrTcM7vg0qGXzDpXP8m9MqdjKt48N3FffQT1IsJWNkxbvJ1Eg5UHDaq+k+oBQ==",
-      "dev": true,
-      "dependencies": {
-        "vue": "^2.6.8"
-      }
-    },
-    "node_modules/@vue/compiler-sfc": {
-      "version": "2.7.10",
-      "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.10.tgz",
-      "integrity": "sha512-55Shns6WPxlYsz4WX7q9ZJBL77sKE1ZAYNYStLs6GbhIOMrNtjMvzcob6gu3cGlfpCR4bT7NXgyJ3tly2+Hx8Q==",
-      "dev": true,
-      "dependencies": {
-        "@babel/parser": "^7.18.4",
-        "postcss": "^8.4.14",
-        "source-map": "^0.6.1"
-      }
-    },
-    "node_modules/crypto-js": {
-      "version": "4.1.1",
-      "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz",
-      "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw=="
-    },
-    "node_modules/csstype": {
-      "version": "3.1.0",
-      "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.0.tgz",
-      "integrity": "sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==",
-      "dev": true
-    },
-    "node_modules/js-base64": {
-      "version": "3.7.2",
-      "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.2.tgz",
-      "integrity": "sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ=="
-    },
-    "node_modules/jweixin-module": {
-      "version": "1.6.0",
-      "resolved": "https://registry.npmjs.org/jweixin-module/-/jweixin-module-1.6.0.tgz",
-      "integrity": "sha512-dGk9cf+ipipHmtzYmKZs5B2toX+p4hLyllGLF6xuC8t+B05oYxd8fYoaRz0T30U2n3RUv8a4iwvjhA+OcYz52w=="
-    },
-    "node_modules/nanoid": {
-      "version": "3.3.4",
-      "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
-      "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
-      "dev": true,
-      "bin": {
-        "nanoid": "bin/nanoid.cjs"
-      },
-      "engines": {
-        "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
-      }
-    },
-    "node_modules/picocolors": {
-      "version": "1.0.0",
-      "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz",
-      "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==",
-      "dev": true
-    },
-    "node_modules/postcss": {
-      "version": "8.4.16",
-      "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
-      "integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
-      "dev": true,
-      "dependencies": {
-        "nanoid": "^3.3.4",
-        "picocolors": "^1.0.0",
-        "source-map-js": "^1.0.2"
-      },
-      "engines": {
-        "node": "^10 || ^12 || >=14"
-      }
-    },
-    "node_modules/source-map": {
-      "version": "0.6.1",
-      "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
-      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
-      }
-    },
-    "node_modules/source-map-js": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
-      "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
-      "dev": true,
-      "engines": {
-        "node": ">=0.10.0"
-      }
-    },
-    "node_modules/uni-read-pages": {
-      "version": "1.0.5",
-      "resolved": "https://registry.npmmirror.com/uni-read-pages/-/uni-read-pages-1.0.5.tgz",
-      "integrity": "sha512-GkrrZ0LX0vn9R5k6RKEi0Ez3Q3e2vUpjXQ8Z6/K/d28KudI9ajqgt8WEjQFlG5EPm1K6uTArN8LlqmZTEixDUA==",
-      "hasInstallScript": true
-    },
-    "node_modules/uni-simple-router": {
-      "version": "2.0.7",
-      "resolved": "https://registry.npmmirror.com/uni-simple-router/-/uni-simple-router-2.0.7.tgz",
-      "integrity": "sha512-8FKv5dw7Eoonm0gkO8udprrxzin0fNUI0+AvIphFkFRH5ZmP5ZWJ2pvnWzb2NiiqQSECTSU5VSB7HhvOSwD5eA=="
-    },
-    "node_modules/uniapp-qrcode": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/uniapp-qrcode/-/uniapp-qrcode-1.0.2.tgz",
-      "integrity": "sha512-jcWwWz4yXsO7if/+78MMXj5VUdZTLu2D6L/IKb4mJkIw87oF11pO3WS/jS27SUcPCrX/BKcir5a2R1uvkaoR9g=="
-    },
-    "node_modules/uploading-oss": {
-      "version": "1.0.3",
-      "resolved": "https://registry.npmjs.org/uploading-oss/-/uploading-oss-1.0.3.tgz",
-      "integrity": "sha512-aqHh5NCOBcrA4d8yCIKR7B9GrKzH88X7gL8BSvIw18pi79AgWnhDkCoyjQmDqzTvjQqYfKwyFTEgnafzMx/GbQ==",
-      "dependencies": {
-        "crypto-js": "^4.1.1",
-        "js-base64": "^2.6.4"
-      }
-    },
-    "node_modules/uploading-oss/node_modules/js-base64": {
-      "version": "2.6.4",
-      "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-2.6.4.tgz",
-      "integrity": "sha512-pZe//GGmwJndub7ZghVHz7vjb2LgC1m8B07Au3eYqeqv9emhESByMXxaEgkUkEqJe87oBbSniGYoQNIBklc7IQ=="
-    },
-    "node_modules/vue": {
-      "version": "2.7.10",
-      "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.10.tgz",
-      "integrity": "sha512-HmFC70qarSHPXcKtW8U8fgIkF6JGvjEmDiVInTkKZP0gIlEPhlVlcJJLkdGIDiNkIeA2zJPQTWJUI4iWe+AVfg==",
-      "dev": true,
-      "dependencies": {
-        "@vue/compiler-sfc": "2.7.10",
-        "csstype": "^3.1.0"
-      }
-    },
-    "node_modules/vue-waterfall-easy": {
-      "version": "2.4.4",
-      "resolved": "https://registry.npmjs.org/vue-waterfall-easy/-/vue-waterfall-easy-2.4.4.tgz",
-      "integrity": "sha512-5OkpT2FPNC3rHBy858zk/nmJxqdPaGmj/KVbmA6dgcvtsovKMa+zuf/Z7F+S2NnObeavpIBztTWgcH3S42ZD+g==",
-      "dev": true,
-      "engines": {
-        "node": ">= 6.0.0",
-        "npm": ">= 3.0.0"
-      }
-    },
-    "node_modules/wecomjsdk": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmmirror.com/wecomjsdk/-/wecomjsdk-1.0.2.tgz",
-      "integrity": "sha512-nPbrTcA5P8IOY/gQJJ3/AtXE2zSqJIQB156RUAQ2+RvwvJmcR66p7hpZtCjbtKefvyDO0LJBdEFqfjRR72zjIw=="
-    }
-  },
+  "lockfileVersion": 1,
   "dependencies": {
     "@babel/parser": {
       "version": "7.19.0",

+ 108 - 82
pages-takeout/shop-mod/menu.vue

@@ -3,7 +3,7 @@
 		<scroll-view scroll-y="true" class="menu-box-left" :scroll-into-view="idMark" :scroll-with-animation='true'>
 			<view class="menu-type-list-f">
 				<view class="menu-type-list fs-26 box-border-box align-items-center flex-justify-center"
-					v-for="(item,i) in typeList" :key="i" @click="selectType(item)"
+					v-for="(item,i) in categoryData" :key="i" @click="selectType(item)"
 					:class="type ===  item.type?'bgc-f fc-3 fw-600':'fc-6 fw-400'" :id="'scroll'+ item.type">
 					{{item.name}}
 					<view class="menu-type-num fc-f" v-show="item.num > 0">{{item.num > 99?'99+':item.num}}</view>
@@ -13,31 +13,30 @@
 
 		<scroll-view :scroll-y="true" :scroll-with-animation='true' :scroll-into-view="idMark" @scroll="menuScroll">
 			<view class="menu-box-right">
-				<view class="menu-box-only" v-for="(item,i) in menuList" :key="i" :id="'scroll'+ item.type">
+				<view class="menu-box-only" v-for="(item,i) in categoryData" :key="i" :id="'scroll'+ item.type">
 					<view class="mb-32 fs-32">{{item.name}}</view>
 					<view class="menu-list flex-justify-space" v-for="(info,k) in item.list" :key="k">
-						<image class="flex-shrink0" src="@/static/img/my/bg.png" mode="scaleToFill"></image>
+						<image class="flex-shrink0" :src="info.goods_image" mode="scaleToFill"></image>
 						<view class="menu-list-right">
-							<view class="mb-4 goods-name text-overflow-ellipsis fs-34 fw-600">[畅销款]奥尔1良烤肉 牛油拌饭[畅销款]奥尔1良烤肉
-								牛油拌饭[畅销款]奥尔1良烤肉 牛油拌饭[畅销款]奥尔1良烤肉 牛油拌饭</view>
-							<view class="mb-20 fw-400 fc-9 fs-24">月销196</view>
+							<view class="mb-4 goods-name text-overflow-ellipsis fs-34 fw-600">{{info.goods_name}}</view>
+							<view class="mb-20 fw-400 fc-9 fs-24">月销{{info.sales}}</view>
 							<view class="flex-justify-space align-items-flex-end">
 								<view class="">
 									<span class="fs-24 fw-400 fc-FB3D03">¥</span>
-									<span class="fs-40 fw-b fc-FB3D03">3.9</span>
-									<span class="fs-24 fc-9 fw-400 text-line-through">¥12</span>
+									<span class="fs-40 fw-b fc-FB3D03">{{info.seckill_money>0?info.seckill_money:info.price}}</span>
+									<span class="fs-24 fc-9 fw-400 text-line-through">¥{{info.line_price}}</span>
 								</view>
-								<view class="display-flex align-items-center" v-if="info.spec != 1">
+								<view class="display-flex align-items-center" v-if="info.spec_type == 1">
 									<view v-show="info.num > 0"
 										class="right-only-right-red fw-500 text-align-center fs-36 fc-f"
-										@click="addred(1,i,k,item)">-</view>
+										@click="addred(1,i,k,info)">-</view>
 									<view v-show="info.num > 0"
 										class="right-only-right-2 text-align-center fs-28 fw-400">{{info.num}}</view>
 									<view class="right-only-right-add fw-500 text-align-center fs-36 fc-f"
-										@click="addred(2,i,k,item)">+</view>
+										@click="addred(2,i,k,info)">+</view>
 								</view>
 								<view v-else class="right-only-right text-align-center fw-600 fs-28 fc-f"
-									@click="addred(3,i,k,item)">选规格</view>
+									@click="addred(3,i,k,info)">选规格</view>
 							</view>
 						</view>
 					</view>
@@ -104,16 +103,35 @@
 
 <script>
 	import tools from "@/service/tools";
+  import {shopCategory, shopGoods} from "@/api/shop";
+  import {getShopIngList} from "@/api/shopping";
 	export default {
 		name: 'menu-box',
+    props:{
+      'shop_id':{
+        default:0
+      }
+    },
 		data() {
 			return {
 				idMark: '', //滚动自适应参数
 
 				type: 1, //分类标识
 				typeList: [],
+        categoryData: [],
 
 				menuList: [],
+				cartData: {
+          total_price:0,
+          total_num:0,
+          total_goods_money:0,
+          pack_price:0,
+          must_category:0,
+          is_place_order:0,
+          err_msg:0,
+          goods_list:0,
+        },
+        operate_id: '',
 
 				popData: {
 					spec_name: '',
@@ -186,66 +204,63 @@
 				},
 			}
 		},
+    watch:{
+      'shop_id':function () {
+        this.getShopGoods();
+      }
+    },
 		mounted() {
-			this.getTypeList();
+      this.operate_id = uni.getStorageSync('operate_id')
+			this.getShopGoods();
+
 		},
 		methods: {
-			getTypeList() {
-				this.typeList = [{
-						"category_id": 1,
-						"name": "爆品推荐",
-						"type": 1,
-					},
-					{
-						"category_id": 2,
-						"name": "必点口味",
-						"type": 2
-					},
-				]
-				this.type = this.typeList[0].type;
-				this.idMark = 'scroll' + this.type;
-				this.typeList.forEach((v) => {
-					v.num = 0
-				})
-
-				this.menuList = [{
-						name: '分类1',
-						type: 1,
-						list: [{
-							name: 1,
-							num: 0,
-							spec: 1
-						}, {
-							name: 2,
-							num: 0
-						}, {
-							name: 3,
-							num: 0
-						}, {
-							name: 4,
-							num: 0
-						}, ]
-					},
-					{
-						name: '分类2',
-						type: 2,
-						list: [{
-							name: 1,
-							num: 0
-						}, {
-							name: 2,
-							num: 0,
-							spec: 1
-						}, {
-							name: 3,
-							num: 0
-						}, {
-							name: 4,
-							num: 0
-						}, ]
-					},
-				]
-			},
+      getShopIngList(){
+        getShopIngList().then(res=>{
+          if(res.code===1){
+            this.cartData=res.data
+          }
+        })
+      },
+      // getShopCategory(){
+      //   if(this.shop_id<0 || !this.operate_id){
+      //     return;
+      //   }
+      //   shopCategory({'shop_id':this.shop_id,	operate_id: this.operate_id,}).then(res=>{
+      //     if(res.code===1){
+      //       for (const cKey in res.data) {
+      //         let item =res.data[cKey]
+      //         item.goodsList=[]
+      //         this.categoryData.push(item)
+      //         if(cKey===0){
+      //           this.selectType(item)
+      //         }
+      //       }
+      //       this.getShopGoods()
+      //     }
+      //   })
+      // },
+      getShopGoods(){
+          if(this.shop_id<0 || !this.operate_id){
+            return;
+          }
+        shopGoods({'shop_id':this.shop_id,	operate_id: this.operate_id,}).then(res=>{
+          if(res.code===1){
+            this.categoryData=res.data
+            if(this.categoryData.length>0){
+              this.selectType(this.categoryData[0])
+            }
+            this.categoryData.forEach(categoryItem=>{
+              categoryItem.list.forEach(goodsItem=>{
+                goodsItem.payNum=0
+                goodsItem.spec=[]
+              })
+            })
+            // console.log(res)
+          }
+        })
+      },
+
 
 			selectType(item) {
 				if (this.type != item.type) {
@@ -267,14 +282,25 @@
 				}).exec();
 			},
 			addred(type, i, k, item) {
+        console.log(item,type)
 				if (type === 1) {
 					// 减
-					this.menuList[i].list[k].num -= 1;
-					this.setSub(item);
+          if(item.num>0){
+            --item.num;
+            // this.menuList[i].list[k].num -= 1;
+            this.setSub(item);
+          }
+
 				} else if (type === 2) {
 					// 加
-					this.menuList[i].list[k].num += 1;
-					this.setSub(item);
+          console.log(item.is_infinite===1 || item.stock>item.num)
+          if(item.is_infinite===1 || item.stock>item.num){
+            ++item.num;
+            this.setSub(item);
+          }
+          console.log(item.num)
+					// this.menuList[i].list[k].num += 1;
+					// this.setSub(item);
 				} else if (type === 3) {
 					// 选规格
 					this.$refs.popupGG.open();
@@ -283,15 +309,15 @@
 				}
 			},
 			setSub(item) {
-				let num = 0;
-				item.list.forEach((n) => {
-					num += n.num
-				})
-				this.typeList.forEach((v) => {
-					if (v.type == item.type) {
-						v.num = num
-					}
-				})
+				// let num = 0;
+				// item.list.forEach((n) => {
+				// 	num += n.num
+				// })
+				// this.typeList.forEach((v) => {
+				// 	if (v.type == item.type) {
+				// 		v.num = num
+				// 	}
+				// })
 			},
 
 			// -------弹窗选择规格-----------

+ 17 - 9
pages-takeout/shop.vue

@@ -56,7 +56,7 @@
 
 
 		<view class="common-view-css bgc-f" style="overflow: hidden;">
-			<Menu style="height: 100%;" v-if="shopType === 1"></Menu>
+			<Menu style="height: 100%;" v-if="shopType === 1"  :shop_id="shop_id"></Menu>
 			<Evaluate style="height: 100%;" :shopId='shop_id' :shopScore='shopsInfo.shop_score' v-else-if="shopType === 2"></Evaluate>
 			<ShopInfo style="height: 100%;" :shopId='shop_id' v-else-if="shopType === 3"></ShopInfo>
 		</view>
@@ -178,10 +178,11 @@
 	import Evaluate from './shop-mod/evaluate.vue';
 	import ShopInfo from './shop-mod/info.vue';
 	import tools from "@/service/tools";
-	import {
-		shopInfo,
-		shopCoupon
-	} from "@/api/shop.js"
+  import {
+    shopInfo,
+    shopCoupon, shopCategory, shopGoods
+  } from "@/api/shop.js"
+  import {getGoodsList} from "@/api/goods";
 	export default {
 		components: {
 			Menu,
@@ -204,13 +205,17 @@
 				shopType: 1, //组件类型
 				shopTypeBsLeft: 12,
 				shop_id: '',
+        operate_id: '',
 				shopsInfo: {},
-				couponData: [] // 可领优惠卷
+				couponData: [], // 可领优惠卷
+				goodsData: [], // 可领优惠卷
+        categoryData: [], // 可领优惠卷
 			}
 		},
 		onLoad(e) {
 			if (e) {
 				this.shop_id = e.shop_id
+        this.operate_id = uni.getStorageSync('operate_id')
 				this.shopInfo()
 			}
 		},
@@ -219,6 +224,7 @@
 			this.shopCoupon()
 		},
 		methods: {
+
 			toBack() {
 				tools.leftClick()
 			},
@@ -270,13 +276,15 @@
 				}).then((res) => {
 					if (res.code == 1) {
 						this.shopsInfo = res.data
-					}
+					}else {
+            tools.error(res.msg)
+            tools.leftClick()
+          }
 				})
 			},
 			shopCoupon() {
-				const operate_id = uni.getStorageSync('operate_id')
 				shopCoupon({
-					operate_id: operate_id,
+					operate_id: this.operate_id,
 					shop_id: this.shop_id
 				}).then((res) => {
 					if (res.code == 1) {

+ 3 - 3
pages.json

@@ -408,9 +408,9 @@
 	"condition": {
 		"current": 0,
 		"list": [{
-			"name": "列表调试",
-			"path": "pages-my/my-ticket",
-			"query": ""
+			"name": "店铺详情",
+			"path": "pages-takeout/shop",
+			"query": "shop_id=1"
 		}]
 	}
 }