lilei hai 8 meses
pai
achega
a1b7641954

+ 1 - 1
App.vue

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

+ 3 - 2
api/video.js

@@ -11,8 +11,9 @@ export const shopBannerList = params => {
 // 轮播图详情信息
 export const shopBannerDetail = params => {
   return request({
-    url: `shopBanner/findBySn/${params.sn}`,
-    method: 'get',
+    url: `shopBanner/context`,
+	data: params,
+    method: 'post',
   })
 }
 // 促销活动列表-分页

+ 5 - 6
pages/index/index.vue

@@ -388,7 +388,8 @@
 			},
 			// 初始化页面
 			pageInit(flag){
-				this.carouselList = []
+				// 获取轮播数据,包括促销活动
+				this.getCarousel()
 				// 已登录
 				if(this.hasLogin){
 					// 已认证用户
@@ -428,8 +429,6 @@
 						this.$store.state.vuex_storeShelf = res.data;
 						// 有数字货架
 						if(res.data){
-							// 获取轮播数据,包括促销活动
-							this.getCarousel()
 							// 查询是否有商城
 							this.getHasShopping(flag)
 							// 只需加载一次
@@ -656,14 +655,14 @@
 					toLogin()
 				}
 			},
-			// 促销活动的轮播图片
+			// 轮播图片
 			getCarousel(){
 				this.carouselList = []
 				// 获取所有促销活动数据
 				shopBannerList({}).then(res => {
 					if(res.status == 200){
 						res.data&&res.data.map(item => {
-							item.image = item.imageUrl // 默认取第一张图片
+							item.image = item.imageUrl
 						})
 						this.carouselList = res.data
 					}
@@ -922,7 +921,7 @@
 			},
 			// 单击banner
 			clickBanner(index){
-				clickBannerList(this.imgList[index])
+				clickBannerList(this.imgList[index],this.hasLogin)
 			},
 			// 查看扫描VIN记录
 			toAllRecord(){

+ 5 - 5
pagesA/activeDetail/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="content" v-if="detail">
-		<view class="titles">{{detail.title}}</view>
+		<!-- <view class="titles">{{detail.bannerName}}</view> -->
 		<view class="acitve-content">
 			<u-parse :html="content" :tag-style="style"></u-parse>
 		</view>
@@ -16,7 +16,7 @@
 				style: {
 					p: 'margin-bottom:10px;'
 				},
-				promoSn: null
+				bannerSn: null
 			}
 		},
 		computed: {
@@ -25,7 +25,7 @@
 			}
 		},
 		onLoad(opts) {
-			this.promoSn = opts.sn
+			this.bannerSn = opts.sn
 			this.getDetail()
 		},
 		methods: {
@@ -33,10 +33,10 @@
 				uni.showLoading({
 					title: "正在加载..."
 				})
-				shopBannerDetail({sn:this.promoSn}).then(res => {
+				shopBannerDetail({bannerSn:this.bannerSn}).then(res => {
 					this.detail = res.data
 					uni.setNavigationBarTitle({
-						title: res.data.name || '活动内容'
+						title: res.data.bannerName || '活动内容'
 					})
 					uni.hideLoading()
 				})

+ 65 - 17
pagesB/cart/index.vue

@@ -62,8 +62,8 @@
 								</view>
 								<view class="flex align_center">
 									<view class="cart-footer-left-price-text1">
-										<text>优惠:¥23.00</text>
-										<text>代金券:¥15.00</text>
+										<text>优惠:¥{{totalDiscount}}</text>
+										<text>代金券:¥{{totalCoupon}}</text>
 									</view>
 								</view>
 							</view>
@@ -113,19 +113,21 @@
 					imgUrl: '/static/kongCart.png'
 				},
 				// 查询条件
-				pageNo: 1,
-				pageSize: 10000,
-				list: [],
-				total: 0,
-				totalAmount: 0,
-				totalNum: 0,
-				totalSel: 0,
-				editFlag: false,
-				allChecked: false,
-				screenWidth: 325,
-				screenHeight: 0,
-				statusBarHeight: 44,
-				safeAreaBottom: 0,
+				pageNo: 1, // 页数
+				pageSize: 10000, // 每页数
+				list: [], // 列表数据
+				total: 0, // 总款数
+				totalAmount: 0, // 总金额
+				totalDiscount:0, // 总优惠
+				totalCoupon: 0, // 总代金券
+				totalNum: 0, // 总数量
+				totalSel: 0, // 已选数量
+				editFlag: false, // 是否编辑状态
+				allChecked: false, // 是否全选
+				screenWidth: 325, // 屏幕宽度
+				screenHeight: 0, // 屏幕高度
+				statusBarHeight: 44, // 状态栏高度
+				safeAreaBottom: 0, // 底部安全区域高度
 			}
 		},
 		computed: {
@@ -170,12 +172,35 @@
 				  const list = res.data.list
 				  for(let i=0;i<list.length;i=i+10){
 					  _this.list.push(list.slice(i,(i+10)>list.length?list.length:(i+10)).map(key=>{
+						  const a = key.shopPromoProduct
+						  if(a){
+							  key.promoType = a.promoType
+							  key.resultValue = a.resultValue
+							  key.conditionValue = a.conditionValue
+							  key.discountType = a.discountType
+							  key.promoProductSn = a.promoProductSn
+							  key.promoSn = a.promoSn
+							  // 特价
+							  if(key.promoType=='PROMO_PROD'){
+								  key.orginPrice = key.price
+								  // 直降
+								  if(key.discountType == 'STRAIGHT_DOWN'){
+									  key.price = key.price - key.resultValue
+								  }
+								  // 折扣
+								  if(key.discountType == 'DISCOUNT'){
+									 key.price = Number(key.price * key.resultValue).toFixed(2)
+								  }
+							  }
+						  }
+						  delete key.shopPromoProduct
 						  return {
 								id: key.id,
 								edit: false,
 								checked: _this.allChecked,
 								cartSn: key.cartSn,
 								price: key.price,
+								orginPrice: key.orginPrice,
 								qty: key.qty,
 								productSn: key.productSn,
 								productName: key.productEntity.productName,
@@ -184,8 +209,14 @@
 								productOrigCode: key.productEntity.origCode,
 								unit: key.productEntity.unit,
 								status: key.status,
-								dealerScopeFlag: key.dealerScopeFlag
-						}
+								dealerScopeFlag: key.dealerScopeFlag,
+								resultValue: key.resultValue,
+								conditionValue: key.conditionValue,
+								discountType: key.discountType,
+								promoType: key.promoType,
+								promoProductSn: key.promoProductSn,
+								promoSn: key.promoSn,
+							}
 					  }))
 				  }
 				  
@@ -506,6 +537,8 @@
 			// 计算总款数、合计、数量
 			getChooseHeji(){
 				this.totalAmount = 0
+				this.totalDiscount = 0
+				this.totalCoupon = 0
 				this.totalNum = 0
 				this.totalSel = 0
 				this.list.forEach(key => {
@@ -513,6 +546,21 @@
 						this.totalAmount += item.price * item.qty // 总金额
 						this.totalNum += item.qty // 总数量
 						this.totalSel += 1 // 已选数量
+						// 如果是返券类型
+						if(item.promoType=='BUY_PROD_GIVE_VALID'){
+							this.totalCoupon += item.resultValue
+						}
+						// 特价
+						if(item.promoType=='PROMO_PROD'){
+							  // 直降
+							  if(item.discountType == 'STRAIGHT_DOWN'){
+								  this.totalDiscount += item.resultValue
+							  }
+							  // 折扣
+							  if(item.discountType == 'DISCOUNT'){
+								 this.totalDiscount += Number(item.price * (1-item.resultValue))
+							  }
+						}
 					})
 				})
 			},

+ 7 - 6
pagesB/cart/productitem.vue

@@ -26,14 +26,14 @@
 						<view class="choose-product-item-left-info-price">
 							<view>
 								<view class="price-txt" v-if="item.status==1">¥<text>{{item.price}}</text></view>
-								<view class="flex align_center rebate-tag" v-if="dix==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="dix==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="dix==3">
-									特价<text>¥20</text>
+								<view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
+									特价<text>¥{{item.orginPrice}}</text>
 								</view>
 							</view>
 							<view>
@@ -286,6 +286,7 @@
 					font-size: 10px;
 					color: #999;
 					margin-left: 5px;
+					text-decoration: line-through;
 				}
 			}
 			.choose-product-item-left-info-name{

+ 6 - 6
pagesB/videos/detail.vue

@@ -8,13 +8,13 @@
 </template>
 
 <script>
-	import { promoTerminalDetail } from '@/api/video.js'
+	import { shopBannerDetail } from '@/api/video.js'
 	export default {
 		data() {
 			return {
 				title: null,
 				content: '',
-				id: null
+				bannerSn: null
 			}
 		},
 		onLoad(opts) {
@@ -23,7 +23,7 @@
 				this.content = opts.content
 				this.videoFull()
 			}else{
-				this.id = opts.sn
+				this.bannerSn = opts.sn
 				this.getDetail()
 			}
 		},
@@ -38,11 +38,11 @@
 				videos.requestFullScreen()
 			},
 			getDetail(){
-				promoTerminalDetail({sn:this.id}).then(res => {
-					this.title = res.data.name
+				shopBannerDetail({bannerSn:this.bannerSn}).then(res => {
+					this.title = res.data.bannerName
 					this.content = res.data.content
 					uni.setNavigationBarTitle({
-						title: res.data.name || '活动内容'
+						title: '视频内容'
 					})
 					this.videoFull()
 				})

+ 14 - 12
utils/index.js

@@ -162,29 +162,31 @@ export function clickTab(row,hasLogin,isNoAuth,isMax){
 	}
 }
 // 单击banner
-export function clickBannerList(row){
+export function clickBannerList(row,hasLogin){
 	 // 红包
 	 if(row.activeType == 'redPacket'){
 	 	uni.navigateTo({url:"/pages/morePage/redPacket"})
 	 }
 	 // 图文
 	 if(row.contentType == 'IMAGE_CONTENT'){
-	 	uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoSn})
+	 	uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.bannerSn})
 	 }
 	 // 视频
 	 if(row.contentType == 'VIDEO'){
-	 	uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoSn})
+	 	uni.navigateTo({url:"/pagesB/videos/detail?form=banner&&sn="+row.bannerSn})
 	 }
 	 // 链接
 	 if(row.contentType == 'LINK'){
-	 	// 货架促销活动
-	 	if(row.content.indexOf("pagesB/promoDetail") >= 0){
-	 		uni.navigateTo({
-	 			url: '/pagesB/promoProduct?promoSn='+row.promoSn+'&title='+row.promoName
-	 		 })
-	 	}else{
-	 		// 外网页面
-	 		openWebView({url:row.content})
-	 	}
+	 	openWebView({url:row.content})
+	 }
+	 // 促销活动
+	 if(row.contentType == 'PROMO_LINK'){
+		 if(hasLogin){
+			 uni.navigateTo({
+			 	url: '/pagesB/promoProduct?promoSn='+row.bizSn+'&title='+row.bannerName
+			 })
+		 }else{
+			 toLogin()
+		 }
 	 }
 }