yijianjun hace 1 día
padre
commit
9230aecdc1

+ 2 - 2
mer_uniapp/config/app.js

@@ -8,8 +8,8 @@
 // | Author: CRMEB Team <admin@crmeb.com>
 // +----------------------------------------------------------------------
 //移动端商城API 网络接口修改此配置,小程序域名要求https 例如:https://api.front.merchant.java.crmeb.net
-// domain = 'https://hncsyy.com.cn'
-let domain = 'http://127.0.0.1:20810'
+let domain = 'https://hncsyy.com.cn'
+// let domain = 'http://127.0.0.1:20810'
 
 module.exports = {
 	// 请求域名 格式: https://您的域名

+ 17 - 2
mer_uniapp/pages/index/index.vue

@@ -140,12 +140,19 @@
 					<view style="margin-top: 22rpx;"><text class="goods-sales">已售卖{{getFormattedSales(item.salesAllNum)}}单</text></view>
 
 					<view style="margin-top: 14rpx;">
-						<text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text>
+						<swiper :indicator-dots="false" :autoplay="true" :circular="true" :display-multiple-items="3" style="height: 43rpx;">
+						  <swiper-item  v-for="(item2,index2) in item.discountLabel" :key="index2">
+						   <text class="goods-labels">{{item2}}</text>
+						  </swiper-item>
+						</swiper>
+						<!-- <text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text> -->
 					</view>
 
 				</view>
 			</view>
-
+				<view class='loadingicon flex-center' :hidden='!loading'>
+					<text class='loading iconfont icon-jiazai' style="width: auto;"></text>加载更多
+				</view>
 
 
 		</view>
@@ -207,6 +214,7 @@
 				// 	checked: false
 				// }],
 				merchantList: [],
+				loading: false,
 				currentIndex: 0,
 				offset: 0,
 			}
@@ -282,6 +290,7 @@
 						color: '#FF9805',
 						linkUrl: '/pages/what_to_eat_today/index/index?id=1'
 					});
+					this.loading = true;
 					getMerchantList({
 						latitude: uni.getStorageSync('user_latitude'),
 						longitude: uni.getStorageSync('user_longitude'),
@@ -290,6 +299,7 @@
 					}).then(res => {
 						this.merchantList = res.data.list;
 						console.log('商品信息:', this.merchantList);
+						this.loading = false;
 					});
 					// this.messageList = [{"id":2,"title":"绿草地活动大促,消费满三十减十五"},{"id":3,"title":"绿草地活动大促,消费满三十减十五33333"}];
 					console.log("this.messageList--", this.messageList)
@@ -299,6 +309,8 @@
 			},
 			item2Click(item) {
 				item.checked = !item.checked;
+				this.merchantList = [];
+				this.loading = true;
 				getMerchantList({
 					latitude: uni.getStorageSync('user_latitude'),
 					longitude: uni.getStorageSync('user_longitude'),
@@ -307,6 +319,7 @@
 				}).then(res => {
 					this.merchantList = res.data.list;
 					console.log('商品信息:', this.merchantList);
+					this.loading = false;
 				});
 			},
 			startScroll() {
@@ -369,6 +382,7 @@
 						longitude: uni.getStorageSync('user_longitude'),
 						success: (res) => {
 							this.userAddress = res.name;
+							this.loading = true;
 							getMerchantList({
 								latitude: res.latitude,
 								longitude: res.longitude,
@@ -377,6 +391,7 @@
 							}).then(data => {
 								this.merchantList = data.data.list;
 								console.log('商品信息:', this.merchantList);
+								this.loading = false;
 							});
 							// this.$set(this.userAddress, 'detail', res.name);
 						}

+ 34 - 26
mer_uniapp/pages/merchant/home/index.vue

@@ -127,7 +127,7 @@
 			<!-- 购物车栏 begin -->
 			<view class="cart-box">
 				<view class="mark">
-					<image src="/static/img/ic-shopping-cart.png" class="cart-img" @tap="cart.length !== 0 ? lockcatble = !lockcatble : ''"></image>
+					<image src="/static/img/ic-shopping-cart.png" class="cart-img" @tap="openCart"></image>
 					<view class="tag" v-if="cart.length > 0">{{ getCartGoodsNumber }}</view>
 				</view>
 				<view style="font-weight: 500;font-size: 27rpx;color: #999999;" class="price" v-if="cart.length === 0">配送费2元</view>
@@ -144,7 +144,7 @@
 					<!-- 判断数量大于0显示 -->
 					<view class="mode-clear" v-if="getCartGoodsNumber>0">
 						<text class="mode-txt">数量:<text style="color: #FD6716 ;">({{getCartGoodsNumber}})</text></text>
-						<text @tap="cart = [], lockcatble = false" class="mode-txt1">清空</text>
+						<text @tap="clearCart" class="mode-txt1">清空</text>
 					</view>
 					<view class="mode-box">
 						<view class="items">
@@ -161,12 +161,12 @@
 									<view class="price_and_action">
 										<text class="price">¥{{ good.price * good.number }}</text>
 										<view class="btn-group">
-											<button type="default" v-show="goodCartNum(good.props_text)" plain class="btn reduce_btn" size="mini"
-											 hover-class="none" @tap="handleReduceFromCart(item, good)">
+											<button type="default" plain class="btn reduce_btn" size="mini"
+											 hover-class="none" @tap="handleReduceFromCart(good.category, good)">
 												<view class="iconfont iconsami-select">-</view>
 											</button>
-											<view class="number" v-show="goodCartNum(good.props_text)">{{ goodCartNum(good.props_text) }}</view>
-											<button type="primary" class="btn add_btn bg-color" size="min" hover-class="none" @tap="handleAddToCart(item, good, 1)">
+											<view class="number" >{{ good.number }}</view>
+											<button type="primary" class="btn add_btn bg-color" size="min" hover-class="none" @tap="handleAddToCart(good.category, good, 1)">
 												<view class="iconfont iconadd-select">+</view>
 											</button>
 										</view>
@@ -446,6 +446,14 @@
 			}
 		},
 		methods: {
+			clearCart(){
+				this.cart = []
+				this.lockcatble = false
+			},
+			openCart(){
+				console.log(this.cart,'this.cart')
+				this.cart.length !== 0 ? this.lockcatble = !this.lockcatble : ''
+			},
 			getFormattedSales(value) {
 						      // 转换成字符串,然后截取前三位,并添加“+”
 						      return value.length>3?`${String(value).slice(0, 3)}+`:value;
@@ -594,7 +602,7 @@
 				// return ''
 			},
 			handleReduceFromCart(item, good) {
-				const goodText = this.getGoodSelectedProps(this.good) // 购物车当前选中的规格
+				const goodText = this.getGoodSelectedProps(this.good?.id ? this.good : good) // 购物车当前选中的规格
 				const index = this.cart.findIndex(item => item.id === good.id && item.props_text === goodText)
 				this.cart[index].number -= 1
 				if (this.cart[index].number <= 0) {
@@ -602,7 +610,7 @@
 				}
 			},
 			handleAddToCart(cate, good, num) { //添加到购物车
-				const goodText = this.getGoodSelectedProps(this.good) // 购物车当前选中的规格
+				const goodText = this.getGoodSelectedProps(this.good?.id ? this.good : good) // 购物车当前选中的规格
 				const index = this.cart.findIndex(item => {
 					// if (good.use_property) {
 					// !good.props_text ? good.props_text = this.getGoodSelectedProps(good) : ''
@@ -622,29 +630,29 @@
 						number: num,
 						icon: good.icon,
 						use_property: good.use_property || goodText,
-						props_text: this.getGoodSelectedProps(this.good),
-						props: this.getGoodSelectedProps(this.good, 'id'),
+						props_text: this.getGoodSelectedProps(this.good?.id ? this.good : good),
+						props: this.getGoodSelectedProps(this.good?.id ? this.good : good, 'id'),
 						productid: this.productObj[goodText].id,
 						iconText: this.productObj[goodText].image,
 						...good
 					})
 				}
-				let q = {
-					productId: parseFloat(good.id),
-					cartNum: parseFloat(index > -1 ? num+this.cart[index].number : num),
-					isNew: false,
-					productAttrUnique: this.productObj[goodText].id,
-				};
-				let that = this
-				postCartAdd(q)
-					.then(function(res) {
-						that.$util.Tips({
-							title: "添加购物车成功",
-							success: () => {
-							},
-						});
-					})
-				console.log(this.cart, '购物车')
+				// let q = {
+				// 	productId: parseFloat(good.id),
+				// 	cartNum: parseFloat(index > -1 ? num+this.cart[index].number : num),
+				// 	isNew: false,
+				// 	productAttrUnique: this.productObj[goodText].id,
+				// };
+				// let that = this
+				// postCartAdd(q)
+				// 	.then(function(res) {
+				// 		that.$util.Tips({
+				// 			title: "添加购物车成功",
+				// 			success: () => {
+				// 			},
+				// 		});
+				// 	})
+				// console.log(this.cart, '购物车')
 			},
 			toPay() {
 				// if(!this.isLogin) {

+ 6 - 1
mer_uniapp/pages/merchant_search/index.vue

@@ -67,7 +67,12 @@
 						<view style="margin-top: 22rpx;"><text class="goods-sales">已售卖{{item.salesVolume}}件</text></view>
 
 						<view style="margin-top: 14rpx;">
-							<text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text>
+							<swiper :indicator-dots="false" :autoplay="true" :circular="true" :display-multiple-items="3" style="height: 43rpx;">
+							  <swiper-item  v-for="(item2,index2) in item.discountLabel" :key="index2">
+							   <text class="goods-labels">{{item2}}</text>
+							  </swiper-item>
+							</swiper>
+							<!-- <text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text> -->
 						</view>
 
 					</view>

+ 5 - 1
mer_uniapp/pages/takeout/index.vue

@@ -96,7 +96,11 @@
 						</view>
 						<view style="margin-top: 22rpx;"><text class="goods-sales">已售卖{{getFormattedSales(item.salesAllNum)}}单</text></view>
 						<view style="margin-top: 14rpx;">
-							<text class="goods-labels" v-for="(item2,index2) in item.discountLabel" :key="index2">{{item2}}</text>
+							<swiper :indicator-dots="false" :autoplay="true" :circular="true" :display-multiple-items="3" style="height: 43rpx;">
+							  <swiper-item  v-for="(item2,index2) in item.discountLabel" :key="index2">
+							   <text class="goods-labels">{{item2}}</text>
+							  </swiper-item>
+							</swiper>
 						</view>
 
 					</view>