lilei 8 месяцев назад
Родитель
Сommit
9cd8f1fe30

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			baseUrl: 'http://192.168.2.100:9110/saas/clz/', // 本地
+			baseUrl: 'http://192.168.2.10:9110/saas/clz/', // 本地
 			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},

+ 10 - 11
api/video.js

@@ -1,25 +1,24 @@
 import request from './request';
 
 // 首页轮播图
-export const promoTerminalList = params => {
+export const shopBannerList = params => {
   return request({
-    url: `promoTerminal/queryPublishList`,
+    url: `shopBanner/queryList`,
     method: 'post',
     data: params
   })
 }
-// 促销活动列表-分页
-export const promoTerminalListByPage = params => {
+// 轮播图详情信息
+export const shopBannerDetail = params => {
   return request({
-    url: `promoTerminal/queryPublishPage/${params.pageNo}/${params.pageSize}`,
-    method: 'post',
-    data: params
+    url: `shopBanner/findBySn/${params.sn}`,
+    method: 'get',
   })
 }
-// 促销活动产品列表-分页
-export const queryPromoProductByPage = params => {
+// 促销活动列表-分页
+export const promoTerminalListByPage = params => {
   return request({
-    url: `promoTerminal/queryPromoProduct/${params.pageNo}/${params.pageSize}`,
+    url: `shopPromo/queryPage/${params.pageNo}/${params.pageSize}`,
     method: 'post',
     data: params
   })
@@ -27,7 +26,7 @@ export const queryPromoProductByPage = params => {
 // 活动详情
 export const promoTerminalDetail = params => {
   return request({
-    url: `promoTerminal/findBySn/${params.sn}`,
+    url: `shopPromo/findBySn/${params.sn}`,
     method: 'get',
   })
 }

+ 28 - 3
pages/index/index.vue

@@ -180,7 +180,7 @@
 	import { findCurrentRewardRule } from '@/api/rewardRule.js'
 	import { listLookUp, getLookUpDatas, getCurrUserInfo } from '@/api/data.js';
 	import { scanVinLogQueryRoll, getScanVinLogList, getScanGetMaxQty }from '@/api/car.js'
-	import { promoTerminalList } from '@/api/video.js'
+	import { shopBannerList } from '@/api/video.js'
 	import { getRewardRollList } from '@/api/rewardRule.js'
 	import { getShopStatus, getCartCount } from '@/api/cart.js'
 	import { getShopCategory, getShopProductList } from '@/api/shop.js'
@@ -572,6 +572,31 @@
 				 getShopProductList({pageNo:this.hotProductPageNo,pageSize:this.hotProductpageSize,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
 					 if(res.status == 200){
 						 const list = res.data ? res.data.list : []
+						 list.map(item=>{
+							  const a = item.shopPromoProduct
+							  if(a){
+								  item.promoType = a.promoType
+								  item.resultValue = a.resultValue
+								  item.conditionValue = a.conditionValue
+								  item.discountType = a.discountType
+								  item.promoProductSn = a.promoProductSn
+								  item.promoSn = a.promoSn
+								  // 特价
+								  if(item.promoType=='PROMO_PROD'){
+									  item.orginPrice = item.price
+									  // 直降
+									  if(item.discountType == 'STRAIGHT_DOWN'){
+										  item.price = item.price - item.resultValue
+									  }
+									  // 折扣
+									  if(item.discountType == 'DISCOUNT'){
+									  	 item.price = Number(item.price * item.resultValue).toFixed(2)
+									  }
+								  }
+							  }
+							  item.priceStr = Number(item.price).toFixed(2).toString().split('.')
+							  delete item.shopPromoProduct
+						 })
 						 if(flag!=1){
 							 this.productList.push(list)
 						 }else{
@@ -635,10 +660,10 @@
 			getCarousel(){
 				this.carouselList = []
 				// 获取所有促销活动数据
-				promoTerminalList({}).then(res => {
+				shopBannerList({}).then(res => {
 					if(res.status == 200){
 						res.data&&res.data.map(item => {
-							item.image = item.imageSet&&item.imageSet[0] // 默认取第一张图片
+							item.image = item.imageUrl // 默认取第一张图片
 						})
 						this.carouselList = res.data
 					}

+ 8 - 7
pages/index/productItem.vue

@@ -17,19 +17,19 @@
 				<view class="product-guige" v-if="!!item.productOrigCode"><text class="ellipsis-two" max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text></view>
 				<view class="product-button">
 					<view class="price-txt" v-if="isLogin&&sysUserFlag == '1'">
-						¥<text>{{Number(item.price).toFixed(2).toString().split('.')[0]}}</text>.{{Number(item.price).toFixed(2).toString().split('.')[1]}}
+						¥<text>{{item.priceStr[0]}}</text>.{{item.priceStr[1]}}
 					</view>
 					<view class="price-txt" v-else>
 						¥***
 					</view>
-					<view class="flex align_center rebate-tag" v-if="isLogin&&index==1">
-						返<text>5</text>元
+					<view class="flex align_center rebate-tag" v-if="isLogin&&item.promoType=='BUY_PROD_GIVE_VALID'">
+						返<text>{{item.resultValue}}</text>元
 					</view>
-					<view class="flex align_center rebate-tag" v-if="isLogin&&index==2">
-						买3赠2
+					<view class="flex align_center rebate-tag" v-if="isLogin&&item.promoType=='BUY_PROD_GIVE_PROD'">
+						买{{item.conditionValue}}赠{{item.resultValue}}
 					</view>
-					<view class="flex align_center tejia-tag" v-if="isLogin&&index==3">
-						特价<text>¥20</text>
+					<view class="flex align_center tejia-tag" v-if="isLogin&&item.promoType=='PROMO_PROD'">
+						特价<text>¥{{item.orginPrice}}</text>
 					</view>
 				</view>
 			</view>
@@ -185,6 +185,7 @@
 					font-size: 12px;
 					color: #999;
 					margin-left: 5px;
+					text-decoration: line-through;
 				}
 			}
 		}

+ 7 - 8
pages/promo/index.vue

@@ -10,9 +10,9 @@
 				>
 					<view class="video-item">
 						<view>
-							<u-image :src="item.imageSet[0]" height="160px" width="100%"></u-image>
+							<u-image :src="item.imageUrl" height="140px" width="100%"></u-image>
 						</view>
-						<view class="ellipsis-two">{{item.title}}</view>
+						<view class="ellipsis-two">{{item.promoName}}</view>
 					</view>
 				 </view>
 				 <view style="padding: 20upx;">
@@ -90,11 +90,10 @@
 			    pageSize: this.pageSize,
 				queryWord: this.queryWord
 			  }
-			  const storeShelf = this.$store.state.vuex_storeShelf
 			  this.status = "loading"
 			  promoTerminalListByPage(params).then(res => {
 				if (res.code == 200 || res.status == 204 || res.status == 200) {
-				  const list = res.data.list.filter(item => item.content.indexOf("pagesB/promoDetail") >= 0)
+				  const list = res.data.list
 				  if(_this.pageNo>1){
 					  _this.list = _this.list.concat(list)
 				  }else{
@@ -112,7 +111,7 @@
 			// 促销活动产品列表页
 			viewRow(item){
 				 uni.navigateTo({
-				 	url: '/pagesB/promoProduct?promoActiveSn='+item.promoActiveSn+'&title='+item.title
+				 	url: '/pagesB/promoProduct?promoSn='+item.promoSn+'&title='+item.promoName
 				 })
 			},
 			// tab单击
@@ -137,9 +136,9 @@
 			height: 100vh;
 			.check-order-list{
 				background: #ffffff;
-				padding: 20upx;
 				margin: 25upx;
 				border-radius: 10upx;
+				overflow: hidden;
 				box-shadow: 1px 1px 3px #EEEEEE;
 				.video-item{
 					> view{
@@ -148,8 +147,8 @@
 						}
 						&:last-child{
 							text-align: center;
-							font-size: 36rpx;
-							margin: 20rpx 0 0;
+							font-size: 32rpx;
+							padding: 20rpx 0;
 						}
 					}
 				}

+ 4 - 4
pagesA/activeDetail/index.vue

@@ -8,7 +8,7 @@
 </template>
 
 <script>
-	import { promoTerminalDetail } from '@/api/video.js'
+	import { shopBannerDetail } from '@/api/video.js'
 	export default {
 		data() {
 			return {
@@ -16,7 +16,7 @@
 				style: {
 					p: 'margin-bottom:10px;'
 				},
-				promoActiveSn: null
+				promoSn: null
 			}
 		},
 		computed: {
@@ -25,7 +25,7 @@
 			}
 		},
 		onLoad(opts) {
-			this.promoActiveSn = opts.sn
+			this.promoSn = opts.sn
 			this.getDetail()
 		},
 		methods: {
@@ -33,7 +33,7 @@
 				uni.showLoading({
 					title: "正在加载..."
 				})
-				promoTerminalDetail({sn:this.promoActiveSn}).then(res => {
+				shopBannerDetail({sn:this.promoSn}).then(res => {
 					this.detail = res.data
 					uni.setNavigationBarTitle({
 						title: res.data.name || '活动内容'

+ 8 - 8
pagesB/components/chooseProductItemSkline.vue

@@ -8,7 +8,6 @@
 			 <view style="flex-grow: 1;">
 				 <view class="choose-product-item-img">
 					<image mode="aspectFit" :src="item.productImage ? item.productImage+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" style="width: 100%;height: 100%;"></image>
-					<view class="back-price fantext" v-if="item.promoRuleValue">返<text>{{item.promoRuleValue}}</text>元</view>
 					<view class="back-price xiajia" v-if="item.status==0">下架</view>
 					<view class="back-price xiajia" v-else-if="item.dealerScopeFlag==0">售罄</view>
 					<view class="choose-product-item-left-info-code ">
@@ -24,17 +23,17 @@
 					</view>
 					<view class="choose-product-item-left-info-price">
 						<view class="price-txt" v-if="isLogin">
-							¥<text>{{Number(item.price).toFixed(2).toString().split('.')[0]}}</text>.{{Number(item.price).toFixed(2).toString().split('.')[1]}}
+							¥<text>{{item.priceStr[0]}}</text>.{{item.priceStr[1]}}
 						</view>
 						<view class="price-txt" v-else>¥***</view>
-						<view class="flex align_center rebate-tag" v-if="index==1">
-							返<text>5</text>元
+						<view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_VALID'">
+							返<text>{{item.resultValue}}</text>元
 						</view>
-						<view class="flex align_center rebate-tag" v-if="index==2">
-							买3赠2
+						<view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_PROD'">
+							买{{item.conditionValue}}赠{{item.resultValue}}
 						</view>
-						<view class="flex align_center tejia-tag" v-if="index==3">
-							特价<text>¥20</text>
+						<view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
+							特价<text>¥{{item.orginPrice}}</text>
 						</view>
 					</view>
 				 </view>
@@ -172,6 +171,7 @@
 						font-size: 12px;
 						color: #999;
 						margin-left: 5px;
+						text-decoration: line-through;
 					}
 				}
 			}

+ 41 - 12
pagesB/components/productItemSkline.vue

@@ -6,24 +6,29 @@
 		class="product-item" 
 		:style="{width:itemWidth+'px',marginTop:gap+'px'}"
 		v-for="(item,index) in list"
-	    :key="item.id" >
-			<view @click="toDetail(item)">
+	    :key="item.id" 
+		 @click="toDetail(item)">
+			<view>
 				<image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_30'" style="height: 140px;width: 100%;"></image>
+				<view class="back-price xiajia" v-if="item.status==0">下架</view>
+				<view class="back-price xiajia" v-else-if="item.dealerScopeFlag==0">售罄</view>
 				<view class="product-code"><text :max-lines="1" overflow="ellipsis">{{item.productCode}}</text></view>
 			</view>
 			<view>
 				<view class="product-name"><text :max-lines="2" overflow="ellipsis">{{item.productName}}</text></view>
 				<view class="product-guige"><text :max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text></view>
 				<view class="product-button">
-					<view class="price-txt">¥<text>{{Number(item.cost).toFixed(2).toString().split('.')[0]}}</text>.{{Number(item.cost).toFixed(2).toString().split('.')[1]}}</view>
-					<view class="flex align_center rebate-tag" v-if="index==1">
-						返<text>{{item.promoRuleValue}}</text>元
+					<view class="price-txt">
+						¥<text>{{item.priceStr[0]}}</text>.{{item.priceStr[1]}}
+					</view>
+					<view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_VALID'">
+						返<text>{{item.resultValue}}</text>元
 					</view>
-					<view class="flex align_center rebate-tag" v-if="index==2">
-						买3赠2
+					<view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_PROD'">
+						买{{item.conditionValue}}赠{{item.resultValue}}
 					</view>
-					<view class="flex align_center tejia-tag" v-if="index==3">
-						特价<text>¥20</text>
+					<view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
+						特价<text>¥{{item.orginPrice}}</text>
 					</view>
 				</view>
 			</view>
@@ -59,9 +64,6 @@
 		},
 		methods: {
 			toDetail(item){
-				uni.navigateTo({
-					url:'/pagesB/shopiing/productDetail?sn='+item.productSn
-				})
 				this.$emit('detail',item)
 			}
 		},
@@ -92,6 +94,32 @@
 			font-size: 36rpx;
 		}
 	}
+	.back-price{
+		zoom: calc(0.8);
+		padding: 6rpx 65rpx;
+		position: absolute;
+		top: 18rpx;
+		right: -45rpx;
+		z-index: 2;
+		font-size: 20rpx;
+		text-align: center;
+		transform: rotate(40deg);
+		display: flex;
+		align-items: center;
+		text{
+			font-size: 28rpx;
+			margin: 0 5rpx;
+		}
+	}
+	.xiajia{
+		background: #ececec;
+		color: #5f5f5f;
+	}
+	.fantext{
+		background: rgba(255 ,87 ,34 , 1);
+		color: #fff;
+		font-size: 8px;
+	}
 	> view{
 		&:first-child{
 			position: relative;
@@ -143,6 +171,7 @@
 					font-size: 12px;
 					color: #999;
 					margin-left: 5px;
+					text-decoration: line-through;
 				}
 			}
 		}

+ 111 - 56
pagesB/procureOrder.vue

@@ -22,36 +22,63 @@
 						共<text class="cText">{{total}}</text>款
 					</view>
 				</view>
-				<view v-for="(item,dix) in partList" :key="item.id" class="flex align-center item-list">
-					<view style="height: 160rpx;width: 160rpx;">
-						<u-image :src="item.product.images+'?x-oss-process=image/resize,p_50'" border-radius="16" width="160" height="160" bg-color="#EBEBEB" ></u-image>
-						<!-- <view class="back-price" v-if="item.giveAmount">返<text>{{item.giveAmount}}</text>元</view> -->
-					</view>
-					<view>
-						<view class="item-name">
-						  <text>{{item.product.productName}}</text>
-						</view>
-						<view class="item-nums" v-if="item.product&&item.product.code">
-							<text>{{item.product.code}}</text>
+				<view v-for="(item,dix) in partList" :key="item.id" class="item-list-box">
+					<view class="item-list flex">
+						<view style="height: 160rpx;width: 160rpx;">
+							<u-image :src="item.product.images+'?x-oss-process=image/resize,p_50'" border-radius="16" width="160" height="160" bg-color="#EBEBEB" ></u-image>
 						</view>
-						<view class="item-nums" v-if="item.product&&item.product.origCode">
-							<text style="color: #00aaff;">{{item.product.origCode}}</text>
-						</view>
-						<view class="item-head">
-							<view class="flex align_center">
-								<view class="price-txt">¥<text>{{item.price}}</text></view>
-								<view class="flex align_center rebate-tag" v-if="dix==0">
-									返<text>5</text>元
-								</view>
-								<view class="flex align_center rebate-tag" v-if="dix==1">
-									买3赠2
+						<view>
+							<view class="item-name">
+							  <text>{{item.product.productName}}</text>
+							</view>
+							<view class="item-nums" v-if="item.product&&item.product.origCode">
+								<text style="color: #00aaff;">{{item.product.origCode}}</text>
+							</view>
+							<view class="item-nums" v-if="item.product&&item.product.code">
+								<text>{{item.product.code}}</text>
+							</view>
+							<view class="item-head">
+								<view class="flex align_center">
+									<view class="price-txt">¥<text>{{item.priceStr[0]}}</text>.{{item.priceStr[1]}}</view>
+									<view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_VALID'">
+										返<text>{{item.resultValue}}</text>元
+									</view>
+									<view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_PROD'">
+										买{{item.conditionValue}}赠{{item.resultValue}}
+									</view>
+									<view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
+										特价<text>¥{{item.orginPrice}}</text>
+									</view>
 								</view>
-								<view class="flex align_center tejia-tag" v-if="dix==2">
-									特价<text>¥20</text>
+								<view>
+									X <text class="cText">{{item.qty}}</text>{{item.product&&item.product.unit||''}}
 								</view>
 							</view>
-							<view>
-								X <text class="cText">{{item.qty}}</text>{{item.product&&item.product.unit||''}}
+						</view>
+					</view>
+					<!-- 赠品 -->
+					<view class="item-list flex gift-box" v-if="item.giftQty">
+						<view style="height: 120rpx;width: 120rpx;margin-left: 40rpx;">
+							<u-image :src="item.product.images+'?x-oss-process=image/resize,p_50'" border-radius="16" width="120" height="120" bg-color="#EBEBEB" ></u-image>
+						</view>
+						<view>
+							<view class="item-name flex align_center ellipsis-one">
+							  <view class="flex align_center rebate-tag">
+							  	赠品
+							  </view>
+							  <text>{{item.product.productName}}</text>
+							</view>
+							<view class="item-nums ellipsis-one" v-if="item.product&&item.product.origCode">
+								<text style="color: #666;">{{item.product.origCode}}</text>
+							</view>
+							<view class="item-nums ellipsis-one" v-if="item.product&&item.product.code">
+								<text>{{item.product.code}}</text>
+							</view>
+							<view class="item-head">
+								<view class="flex align_center"></view>
+								<view>
+									X <text class="cText">{{item.giftQty}}</text>{{item.product&&item.product.unit||''}}
+								</view>
 							</view>
 						</view>
 					</view>
@@ -62,17 +89,17 @@
 				</view>
 			</view>
 			<view class="info" v-if="info">
-				<view class="infoList">
-					<text>总金额</text>
-					<text class="redText">¥{{info.totalAmount}}</text>
+				<view class="infoList" v-if="info.totalTicketGiveAmount">
+					<text>代金券</text>
+					<text class="cText">¥{{info.totalTicketGiveAmount}}</text>
 				</view>
-				<view class="infoList">
+				<view class="infoList" v-if="info.totalSpecialGiveAmount">
 					<text>总优惠</text>
-					<text class="cText">¥{{info.totalAmount}}</text>
+					<text class="cText">¥{{info.totalSpecialGiveAmount}}</text>
 				</view>
-				<view class="infoList" v-if="state=='FINISH'">
-					<text>代金券</text>
-					<text class="cText">¥{{info.totalGiveAmount}}</text>
+				<view class="infoList">
+					<text>总金额</text>
+					<text class="redText">¥{{info.totalAmount}}</text>
 				</view>
 			</view>
 			<view class="info" v-if="info">
@@ -180,7 +207,34 @@
 		   })
 		   purchaseQueryDetailPage({purchaseSn: this.purchaseSn,pageNo:this.pageNo,pageSize:this.pageSize}).then(res => {
 				if(res.status == 200){
-					this.partList = res.data ? res.data.list : [],
+					this.partList = res.data ? res.data.list : []
+					this.partList.map(item=>{
+					  const a = item.shopPromoProduct
+					  if(a){
+						  item.promoType = a.promoType
+						  item.resultValue = a.resultValue
+						  item.conditionValue = a.conditionValue
+						  item.discountType = a.discountType
+						  item.promoProductSn = a.promoProductSn
+						  item.promoSn = a.promoSn
+						  // 特价
+						  if(item.promoType=='PROMO_PROD'){
+							  item.orginPrice = item.price
+							  // 直降
+							  if(item.discountType == 'STRAIGHT_DOWN'){
+								  item.price = item.price - item.resultValue
+							  }
+							  // 折扣
+							  if(item.discountType == 'DISCOUNT'){
+								 item.price = Number(item.price * item.resultValue).toFixed(2)
+							  }
+						  }
+						  // 满赠数量
+						  item.giftQty = item.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(item.qty / item.conditionValue)*item.resultValue : 0
+					  }
+					  item.priceStr = Number(item.price).toFixed(2).toString().split('.')
+					  delete item.shopPromoProduct
+					})
 					this.total = res.data ? res.data.count : 0
 				}
 				// 滚动到顶部
@@ -316,8 +370,10 @@
 					}
 				}
 			}
-			.item-list{
+			.item-list-box{
 				border-bottom: 2rpx solid #f2f2f2;
+			}
+			.item-list{
 				padding: 20rpx 0;
 				&:last-child{
 					border: none;
@@ -325,7 +381,6 @@
 				> view{
 					&:first-child{
 						margin-right: 20rpx;
-						margin-top: 18rpx;
 						position: relative;
 						overflow: hidden;
 						width: 160rpx;
@@ -333,25 +388,6 @@
 						border-radius: 6px;
 						border: 1px solid #eee;
 					}
-					.back-price{
-						zoom: calc(0.8);
-						padding: 6rpx 65rpx;
-						background: rgba(255 ,87 ,34 , 1);
-						position: absolute;
-						top: 20rpx;
-						right: -55rpx;
-						color: #fff;
-						z-index: 2;
-						font-size: 20rpx;
-						text-align: center;
-						transform: rotate(40deg);
-						display: flex;
-						align-items: center;
-						text{
-							font-size: 28rpx;
-							margin: 0 5rpx;
-						}
-					}
 					&:last-child{
 						flex-grow: 1;
 						width: 60%;
@@ -408,10 +444,29 @@
 						font-size: 12px;
 						color: #999;
 						margin-left: 5px;
+						text-decoration: line-through;
 					}
 				}
 			}
 		}
+		.gift-box.item-list{
+			.item-name{
+				color: #666;
+				font-size: 12px;
+				font-weight: normal;
+			}
+			.item-nums{
+				text{
+					color: #666;
+					font-size: 12px;
+				}
+			}
+			.rebate-tag{
+				width: 40px;
+				margin-left: 0;
+				margin-right: 5px;
+			}
+		}
 		.footer{
 			padding: 20upx 60upx;
 			background: #FFFFFF;

+ 5 - 3
pagesB/procureOrderList.vue

@@ -110,9 +110,11 @@
 			},
 			// tabs通知swiper切换
 			tabsChange(index) {
-				this.list = []
-				this.status = "loading"
-				this.swiperCurrent = index;
+				if(index != this.swiperCurrent){
+					this.list = []
+					this.status = "loading"
+					this.swiperCurrent = index;
+				}
 			},
 			swiperChange(event){
 				this.list = []

+ 56 - 13
pagesB/promoProduct.vue

@@ -24,7 +24,7 @@
 			:index="index"
 			:itemWidth="(screenWidth*0.96-screenWidth*0.02)*0.5"
 			:gap="screenWidth*0.02"
-			@chooseProduct="chooseProduct"
+			@detail="toDetail"
 			></productItem>
 			<!-- loading -->
 			<view class="loading-bar" v-if="list.length && (loading||loadEnd)">{{loadText}}</view>
@@ -41,7 +41,7 @@
 	    mapState,
 	    mapMutations,
 	} from 'vuex'
-	import { queryPromoProductByPage } from '@/api/video.js'
+	import { getShopProductList } from '@/api/shop.js'
 	import productItem from '@/pagesB/components/productItemSkline.vue'
 	import sklineHeader from '@/components/skline/sklineHeader.vue'
 	export default {
@@ -53,7 +53,7 @@
 			return {
 				title: '促销产品列表',
 				pageNo:1,
-				pageSize:16,
+				pageSize:8,
 				total:0,
 				list:[],
 				loading:false,
@@ -64,7 +64,7 @@
 					imgUrl: '/static/nodata.png'
 				},
 				queryWord:'',
-				promoActiveSn:'',
+				promoSn:'',
 				screenWidth: 750,
 				screenHeight: 0,
 				statusBarHeight: 44,
@@ -77,6 +77,9 @@
 			userInfo(){
 				return this.$store.state.vuex_userInfo
 			},
+			storeShelf(){
+				return this.$store.state.vuex_storeShelf
+			}
 		},
 		onLoad(opts) {
 			this.title = opts.title||'促销产品列表'
@@ -88,7 +91,7 @@
 			
 			// 清空临时数据
 			this.$store.state.vuex_tempData = null
-			this.promoActiveSn = opts.promoActiveSn
+			this.promoSn = opts.promoSn
 			
 			// 查询列表
 			this.getList()
@@ -100,6 +103,11 @@
 			goBack() {
 				uni.navigateBack();
 			},
+			toDetail(item){
+				uni.navigateTo({
+					url:'/pagesB/shopiing/productDetail?sn='+item.shopProductSn
+				})
+			},
 			// 滚动到底部
 			reachBottom() {
 				if(!this.loading && !this.loadEnd){
@@ -119,11 +127,13 @@
 			// 列表查询
 			getList(){
 				this.loading = true
-				queryPromoProductByPage({
+				const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1'&&this.storeShelf ? this.storeShelf.dealerSn : ''
+				getShopProductList({
 					pageNo: this.pageNo,
 					pageSize: this.pageSize,
 					queryWord: this.queryWord,
-					promoActiveSn: this.promoActiveSn
+					promoSn: this.promoSn,
+					dealerSn: dealerSn
 				}).then(res => {
 					this.loading = false
 					if(res.status == 200){
@@ -133,21 +143,54 @@
 							const ret = []
 							// 更新已选状态
 							list.forEach(k => {
+								const a = k.shopPromoProduct
+								if(a){
+								  k.promoType = a.promoType
+								  k.resultValue = a.resultValue
+								  k.conditionValue = a.conditionValue
+								  k.discountType = a.discountType
+								  k.promoProductSn = a.promoProductSn
+								  k.promoSn = a.promoSn
+								  // 特价
+								  if(k.promoType=='PROMO_PROD'){
+									  k.orginPrice = k.price
+									  // 直降
+									  if(k.discountType == 'STRAIGHT_DOWN'){
+										  k.price = k.price - k.resultValue
+									  }
+									  // 折扣
+									  if(k.discountType == 'DISCOUNT'){
+										 k.price = Number(k.price * k.resultValue).toFixed(2)
+									  }
+								  }
+								}
 							  // 如果筛选或分页后,更新页面列表产品数量
 							  ret.push({
 								  id: k.id,
-								  cost: k.cost,
 								  checked: false,
 								  qty: 0,
+								  price: k.price,
+								  orginPrice: k.orginPrice,
+								  priceStr: Number(k.price).toFixed(2).toString().split('.'),
 								  productCode: k.productCode,
 								  productSn: k.productSn,
-								  productImage: k.productImage,
+								  productImage: k.productMsg,
 								  productName: k.productName,
 								  productOrigCode: k.productOrigCode,
-								  promoActiveSn: k.promoActiveSn,
-								  promoRuleSn: k.promoRuleSn,
-								  promoRuleValue: k.promoRuleValue,
-								  promoRuleType: k.promoRuleType,
+								  categorySn: k.categorySn,
+								  hotFlag: k.hotFlag,
+								  productSn: k.productSn,
+								  priceType: k.priceType,
+								  shopProductSn: k.shopProductSn,
+								  status: k.status,
+								  statusDictValue: k.statusDictValue,
+								  dealerScopeFlag: k.dealerScopeFlag,
+								  promoType: k.promoType,
+								  resultValue: k.resultValue,
+								  conditionValue: k.conditionValue,
+								  discountType: k.discountType,
+								  promoProductSn: k.promoProductSn,
+								  promoSn: k.promoSn
 							  })
 							})
 							// 追加数据

+ 57 - 23
pagesB/shopiing/productDetail.vue

@@ -19,7 +19,7 @@
 				<view class="product-info-text">
 					<view class="product-info-text-title">
 						{{detail.productName}} 
-						<view class="copyText" @click="copy(detail.productName)">复制</view>
+						<!-- <view class="copyText" @click="copy(detail.productName)">复制</view> -->
 						<uni-tag style="margin-left: 10px;" size="mini" :circle="true" v-if="detail.status==0 || detail.dealerScopeFlag==0" :text="detail.status==0?'已下架':'已售罄'"></uni-tag>
 					</view>
 					<view class="product-info-text-attr">
@@ -28,16 +28,16 @@
 						</view>
 						<view class="flex align_center" v-else>
 							<view class="product-info-price">
-								¥<text>{{Number(detail.price).toFixed(2).toString().split('.')[0]}}</text>.{{Number(detail.price).toFixed(2).toString().split('.')[1]}}
+								¥<text>{{detail.priceStr[0]}}</text>.{{detail.priceStr[1]}}
 							</view>
-							<view class="flex align_center rebate-tag" v-if="detail.price==30">
-								返<text>5</text>元
+							<view class="flex align_center rebate-tag" v-if="detail.promoType=='BUY_PROD_GIVE_VALID'">
+								返<text>{{detail.resultValue}}</text>元
 							</view>
-							<view class="flex align_center rebate-tag" v-if="detail.price==24">
-								买3赠2
+							<view class="flex align_center rebate-tag" v-if="detail.promoType=='BUY_PROD_GIVE_PROD'">
+								买{{detail.conditionValue}}赠{{detail.resultValue}}
 							</view>
-							<view class="flex align_center tejia-tag" v-if="detail.price==21">
-								特价<text>¥20</text>
+							<view class="flex align_center tejia-tag" v-if="detail.promoType=='PROMO_PROD'">
+								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
 						</view>
 						<view class="product-info-nums">
@@ -112,17 +112,17 @@
 						</view>
 						<view class="popu-content-box">
 							<view class="popu-content-price" v-if="hasLogin">
-								¥<text>{{Number(detail.price).toFixed(2).toString().split('.')[0]}}</text>.{{Number(detail.price).toFixed(2).toString().split('.')[1]}}
+								¥<text>{{detail.priceStr[0]}}</text>.{{detail.priceStr[1]}}
 							</view>
 							<view class="popu-content-price" v-else>¥***</view>
-							<view class="flex align_center rebate-tag" v-if="detail.price==30">
-								返<text>5</text>元
+							<view class="flex align_center rebate-tag" v-if="detail.promoType=='BUY_PROD_GIVE_VALID'">
+								返<text>{{detail.resultValue}}</text>元
 							</view>
-							<view class="flex align_center rebate-tag" v-if="detail.price==24">
-								买3赠2
+							<view class="flex align_center rebate-tag" v-if="detail.promoType=='BUY_PROD_GIVE_PROD'">
+								买{{detail.conditionValue}}赠{{detail.resultValue}}
 							</view>
-							<view class="flex align_center tejia-tag" v-if="detail.price==21">
-								特价<text>¥20</text>
+							<view class="flex align_center tejia-tag" v-if="detail.promoType=='PROMO_PROD'">
+								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
 						</view>
 						<view class="popu-content-num flex align_center justify_end">
@@ -131,7 +131,7 @@
 						</view>
 					</view>
 				</view>
-				<view class="pupu-box gift-box">
+				<view class="pupu-box gift-box" v-if="giftNum">
 					<view class="popu-content-img">
 						<image style="width: 50px; height: 50px;" mode="aspectFit" :src="detail.productMsg||'/static/def_imgs.png'"></image>
 					</view>
@@ -145,7 +145,7 @@
 						<view class="popu-content-box justify_between">
 							<view></view>
 							<view class="popu-content-num flex align_center">
-								<text>X</text> 1
+								<text>X</text> {{giftNum}}
 							</view>
 						</view>
 					</view>
@@ -195,6 +195,9 @@
 			// 获取产品详情
 			this.getDetail()
 		},
+		onShow(){
+			this.closePopu()
+		},
 		// 分享
 		onShareAppMessage(e){
 			return {
@@ -212,6 +215,10 @@
 			},
 			totalNum(){
 				return this.hasLogin&&this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_cartTotal : 0
+			},
+			// 赠品数量
+			giftNum(){
+				return this.detail && this.detail.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(this.qty / this.detail.conditionValue)*this.detail.resultValue : 0
 			}
 		},
 		methods: {
@@ -254,6 +261,28 @@
 							res.data.productPicList.forEach(item => {
 								this.imgList.push(item.imageUrl||'/static/def_imgs.png')
 							})
+							const a = res.data.shopPromoProduct
+							if(a){
+							  res.data.promoType = a.promoType
+							  res.data.resultValue = a.resultValue
+							  res.data.conditionValue = a.conditionValue
+							  res.data.discountType = a.discountType
+							  res.data.promoProductSn = a.promoProductSn
+							  res.data.promoSn = a.promoSn
+							  // 特价
+							  if(res.data.promoType=='PROMO_PROD'){
+								  res.data.orginPrice = res.data.price
+								  // 直降
+								  if(res.data.discountType == 'STRAIGHT_DOWN'){
+									  res.data.price = res.data.price - res.data.resultValue
+								  }
+								  // 折扣
+								  if(res.data.discountType == 'DISCOUNT'){
+									 res.data.price = Number(res.data.price * res.data.resultValue).toFixed(2)
+								  }
+							  }
+							}
+							res.data.priceStr = Number(res.data.price).toFixed(2).toString().split('.')
 						}else{
 							this.imgList.push(res.data.productMsg||'/static/def_imgs.png')
 						}
@@ -345,6 +374,7 @@
 							qty: this.qty,
 							price:this.detail.price,
 						}]}).then(res => {
+					uni.hideLoading()
 					if(res.status == 200){
 						const successList = res.data.successList.map(item => {
 							return {
@@ -364,7 +394,6 @@
 								showCancel: successList.length,
 								confirmText: successList.length?'确定':'知道了',
 								success(ret) {
-									uni.hideLoading()
 									if(ret.confirm && successList.length){
 										_this.submitForm(successList)
 									}
@@ -375,7 +404,6 @@
 							_this.submitForm(successList)
 						}
 					}else{
-						uni.hideLoading()
 						uni.showToast({
 							title: res.message,
 							icon: 'none'
@@ -384,16 +412,20 @@
 				})
 			},
 			submitForm(detailList){
+				uni.showLoading({
+					title: '提交中...',
+					mask: true
+				})
 				purchaseSave({
 					detailList: detailList
 				}).then(res => {
-					uni.hideLoading()
 					if(res.status == 200){
 						res.data.detailList = []
 						this.$store.state.vuex_tempData = res.data
 						this.showPopu = false
 						this.submitOk = true
 					}else{
+						uni.hideLoading()
 						uni.showToast({
 							title: res.message,
 							icon: 'none'
@@ -405,13 +437,14 @@
 			closePopu(){
 				this.showPopu = false
 				this.qty = 1
-				uni.hideLoading()
-				// 提交成功
 				if(this.submitOk){
 					uni.navigateTo({
 						url: "/pagesB/procureOrder"
 					})
 				}
+				setTimeout(()=>{
+					uni.hideLoading()
+				},300)
 			},
 		}
 	}
@@ -563,6 +596,7 @@
 				font-size: 12px;
 				color: #999;
 				margin-left: 5px;
+				text-decoration: line-through;
 			}
 		}
 		.scrollPage-footer{
@@ -680,7 +714,7 @@
 						margin: 0 5px 0 0;
 						background: #ff0000;
 						color: #fff;
-						width: 50px;
+						width: 40px;
 						flex-grow: 1;
 						display: flex;
 						justify-content: center;

+ 30 - 1
pagesB/shopiing/searchProduct.vue

@@ -215,9 +215,32 @@
 						if(this.total){
 							const list = res.data.list || []
 							const ret = list.map(k => {
+								const a = k.shopPromoProduct
+								if(a){
+								  k.promoType = a.promoType
+								  k.resultValue = a.resultValue
+								  k.conditionValue = a.conditionValue
+								  k.discountType = a.discountType
+								  k.promoProductSn = a.promoProductSn
+								  k.promoSn = a.promoSn
+								  // 特价
+								  if(k.promoType=='PROMO_PROD'){
+									  k.orginPrice = k.price
+									  // 直降
+									  if(k.discountType == 'STRAIGHT_DOWN'){
+										  k.price = k.price - k.resultValue
+									  }
+									  // 折扣
+									  if(k.discountType == 'DISCOUNT'){
+										 k.price = Number(k.price * k.resultValue).toFixed(2)
+									  }
+								  }
+								}
 								return {
 								  id: k.id,
 								  price: k.price,
+								  orginPrice: k.orginPrice,
+								  priceStr: Number(k.price).toFixed(2).toString().split('.'),
 								  productCode: k.productCode,
 								  productSn: k.productSn,
 								  productImage: k.productMsg,
@@ -230,7 +253,13 @@
 								  shopProductSn: k.shopProductSn,
 								  status: k.status,
 								  statusDictValue: k.statusDictValue,
-								  dealerScopeFlag: k.dealerScopeFlag
+								  dealerScopeFlag: k.dealerScopeFlag,
+								  promoType: k.promoType,
+								  resultValue: k.resultValue,
+								  conditionValue: k.conditionValue,
+								  discountType: k.discountType,
+								  promoProductSn: k.promoProductSn,
+								  promoSn: k.promoSn
 							  }
 							})
 							// 追加数据

+ 52 - 23
pagesB/shopiing/shopProduct.vue

@@ -8,13 +8,13 @@
 					<uni-icons type="arrowleft" size="20"></uni-icons>
 					<text>返回</text>
 				</view>
-				<view class="search-head" @click="goSearch">
-					<uni-search-bar readonly radius="100" placeholder="请输入商品名称/产品编码/原厂编码" textColor="#666" clearButton="auto" cancelButton="none" />
+				<view class="header-title">
+					<text :max-lines="1" overflow="ellipsis">{{title}}</text>
 				</view>
-				<view></view>
+				<view class="header-right"></view>
 			</view>
-			<view class="header-title">
-				<text :max-lines="1" overflow="ellipsis">{{title}}</text>
+			<view class="search-head" @click="goSearch">
+				<uni-search-bar readonly radius="100" placeholder="请输入商品名称/产品编码/原厂编码" textColor="#666" clearButton="auto" cancelButton="none" />
 			</view>
 		</view>
 		<view class="search-result">
@@ -209,7 +209,9 @@
 			onRestore(e){
 				console.log('onRestore')
 				this.queryWord = ''
-				this.searchList()
+				if(this.categorySn!=null){
+					this.searchList()
+				}
 			},
 			// 自定义下拉刷新被中止
 			onAbort(e){
@@ -218,11 +220,12 @@
 			},
 			// 滚动到底部
 			reachBottom() {
-				console.log('reachBottom',this.pulling)
-				if(this.enableRefresh){
-					if(!this.loading && !this.loadEnd && !this.pulling){
-						this.pageNo++
-						this.getList()
+				if(this.enableRefresh&&this.categorySn!=null){
+					if(!this.loading && !this.loadEnd){
+						if(!this.pulling){
+							this.pageNo++
+							this.getList()
+						}
 					}
 					if(this.pulling){
 						this.pulling = false
@@ -251,9 +254,32 @@
 							const list = res.data.list || []
 							// 更新已选状态
 							const ret = list.map(k => {
+								const a = k.shopPromoProduct
+								if(a){
+								  k.promoType = a.promoType
+								  k.resultValue = a.resultValue
+								  k.conditionValue = a.conditionValue
+								  k.discountType = a.discountType
+								  k.promoProductSn = a.promoProductSn
+								  k.promoSn = a.promoSn
+								  // 特价
+								  if(k.promoType=='PROMO_PROD'){
+									  k.orginPrice = k.price
+									  // 直降
+									  if(k.discountType == 'STRAIGHT_DOWN'){
+										  k.price = k.price - k.resultValue
+									  }
+									  // 折扣
+									  if(k.discountType == 'DISCOUNT'){
+										 k.price = Number(k.price * k.resultValue).toFixed(2)
+									  }
+								  }
+								}
 								return {
 								  id: k.id,
 								  price: k.price,
+								  orginPrice: k.orginPrice,
+								  priceStr: Number(k.price).toFixed(2).toString().split('.'),
 								  productCode: k.productCode,
 								  productSn: k.productSn,
 								  productImage: k.productMsg,
@@ -266,7 +292,13 @@
 								  shopProductSn: k.shopProductSn,
 								  status: k.status,
 								  statusDictValue: k.statusDictValue,
-								  dealerScopeFlag: k.dealerScopeFlag
+								  dealerScopeFlag: k.dealerScopeFlag,
+								  promoType: k.promoType,
+								  resultValue: k.resultValue,
+								  conditionValue: k.conditionValue,
+								  discountType: k.discountType,
+								  promoProductSn: k.promoProductSn,
+								  promoSn: k.promoSn
 							  }
 							})
 							// 追加数据
@@ -315,14 +347,11 @@
 			height: 44px;
 			background-color: #FFFFFF;
 			border-bottom: 1px solid #e8e8e8;
-			.search-head{
+			.header-title{
 				flex-grow: 1;
-				/deep/ .uni-searchbar{
-					padding: 0 6px;
-				}
-				/deep/ .uni-searchbar .uni-searchbar__box{
-					height: 30px;
-				}
+				color: #333333;
+				padding: 10px;
+				text-align: center;
 			}
 			.header-left{
 				display: flex;
@@ -338,11 +367,11 @@
 			}
 		}
 	}
-	.header-title{
+	.search-head{
 		background-color: #FFFFFF;
-		color: #333333;
-		padding: 10px;
-		text-align: center;
+		/deep/ .uni-searchbar{
+			padding: 5px 6px;
+		}
 	}
 	.search-result{
 		flex-grow: 1;

+ 3 - 3
utils/index.js

@@ -169,18 +169,18 @@ export function clickBannerList(row){
 	 }
 	 // 图文
 	 if(row.contentType == 'IMAGE_CONTENT'){
-	 	uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
+	 	uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoSn})
 	 }
 	 // 视频
 	 if(row.contentType == 'VIDEO'){
-	 	uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
+	 	uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoSn})
 	 }
 	 // 链接
 	 if(row.contentType == 'LINK'){
 	 	// 货架促销活动
 	 	if(row.content.indexOf("pagesB/promoDetail") >= 0){
 	 		uni.navigateTo({
-	 			url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
+	 			url: '/pagesB/promoProduct?promoSn='+row.promoSn+'&title='+row.promoName
 	 		 })
 	 	}else{
 	 		// 外网页面