Bladeren bron

对接会员中心

hmp 4 jaren geleden
bovenliggende
commit
12f7a41ffd

+ 11 - 1
assets/http/api.js

@@ -11,6 +11,7 @@ const sms={
 }
 //商场管理
 const mall={
+	detail:p => http.get("cyzh-ldt/mall/detail", {params:p}),
 	getListByPhone:p => http.get("cyzh-ldt/app/mall/getMyMallList", {params:p}),
 	getShopLabelByMallId:p => http.get("cyzh-ldt/app/mall/getShopLabelByMallId?mallId="+p),
 	getMallAreaByMallId:p => http.get("cyzh-ldt/app/mall/getMallAreaByMallId?mallId="+p),
@@ -18,6 +19,14 @@ const mall={
 	statistic:p => http.get("cyzh-ldt/app/mall/statistic?mallId="+p),
 }
 
+
+const memberCenter={
+	list:p => http.get('cyzh-ldt/app/mall/getMembersByMallId',{params:p}),
+	create:(p)=> http.post('cyzh-ldt/app/mall/createMemberCenter',p),
+}
+
+
+
 const shop={
 	stop:p => http.post('cyzh-ldt/shop/update',p),
 	detail:p => http.get("cyzh-ldt/shop/detail", {params:p}),
@@ -31,7 +40,7 @@ const activity={
 	//退出活动
 	exit:(p)=> http.post('cyzh-ldt/activityjoinrecord/exitBatch',p),
 	//参加活动
-	join:(p)=> http.post('cyzh-ldt/activityjoinrecord/joinBatch',p),
+	join:(p)=> http.post('cyzh-ldt/activityjoinrecord/submit',p),
 	//活动详情
 	detail:p => http.get("/cyzh-ldt/activity/detail", {params:p}),
 }
@@ -40,6 +49,7 @@ export const api={
 	uploadFile,
 	sms,
 	mall,
+	memberCenter,
 	shop,
 	activity
 }

+ 9 - 0
pages.json

@@ -96,6 +96,15 @@
 		    }
 		    
 		}
+        ,{
+            "path" : "pages/member-center/add",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "创建会员中心",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 0 - 20
pages/activity/activity.vue

@@ -97,26 +97,6 @@
 					})
 				})
 			},
-			join(){
-				this.$dialog.showModal("确定参加?").then(res=>{
-					let ids= this.dataList.filter(item=>item.checked==true).map(item=>item.id)
-					let operateList=[]
-					ids.forEach(item=>{
-						let tmp={
-							activityId:item,
-							joinType:1,
-							joinId:this.vuex_mallId
-						}
-						operateList.push(tmp)
-					})
-					this.$api.activity.join(operateList).then(res=>{
-						if (res.success) {
-							this.$refs.cardRef.hideCheckAll()
-							this.mescroll.resetUpScroll();
-						}
-					})
-				})
-			},
 			stop(){
 				this.$dialog.showModal('确定停用活动?').then(res=>{
 					let tmp=this.$u.deepClone(this.dataList)

+ 1 - 1
pages/login/login.vue

@@ -61,7 +61,7 @@
 				},
 				codeTips: '',
 				form:{
-					phone:'19124812874',
+					phone:'',
 					code:''
 				},
 				rules: {

+ 149 - 0
pages/member-center/add.vue

@@ -0,0 +1,149 @@
+<template>
+	<view>
+		<view class="margin-30">
+			<text class="build_title">构建您的私域流量</text>
+		</view>
+		<view class="card">
+			<text class="title">会员门槛</text>
+			<text class="desc">完成一笔任意金额交易即成会员</text>
+		</view>
+		<view class="card margin-top-30">
+			<text class="title">积分使用范围</text>
+			<text class="desc">通用(可在任意场景使用)</text>
+		</view>
+		
+		<view class="card margin-top-30">
+			<view class="margin-bottom-20">
+				<text class="title">积分价值</text>
+				<text class="sub_title">(例:1000积分=10元)</text>
+			</view>
+			<view class="flex">
+				<view class="center" style="width: 45%;">
+					<u-input height="50" :border="true" :clearable="false" v-model="form.point" placeholder="请输入积分数"/>
+					<view class="cu-tag bg-color radius">
+						积分
+					</view>
+				</view>
+				<view class="center" style="margin: 0 20rpx;">
+					<text>=</text>
+				</view>
+				<view class="center" style="width: 45%;">
+					<u-input height="50" :border="true" :clearable="false" v-model="form.pointValue" placeholder="请输入积分值" />
+					<view class="cu-tag bg-color radius">
+						元
+					</view>
+				</view>
+			</view>
+		</view>
+		
+		<view class="card margin-top-30">
+			<view class="margin-bottom-20">
+				<text class="title">积分规则</text>
+			</view>
+			<view class="flex">
+				<view class="center">
+					<text>消费1元赠送</text>
+				</view>
+				<view class="center" style="width: 45%;margin-left: 20rpx;">
+					<u-input height="50" :border="true" :clearable="false" v-model="form.consumeOnePoint" placeholder="请输入积分数"/>
+					<view class="cu-tag bg-color radius">
+						积分
+					</view>
+				</view>
+			</view>
+		</view>
+		
+		<view class="center flex-direction" style="margin-top: 280rpx;">
+			<view class="margin-bottom-30 text-sm">
+				<text>提交代表已同意</text>
+				<text style="color: #3099F1;">会员中心规则说明</text>
+			</view>
+			<view @click="submit" class="cu-btn bg-color round" style="width: 70%;height: 90rpx;font-size: 36rpx;">
+				提交
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				form:{
+					point:'',
+					pointValue:'',
+					consumeOnePoint:''
+				}
+			}
+		},
+		methods: {
+			submit(){
+				if (this.$isEmpty(this.form.point)) {
+					this.$u.toast('请输入积分数')
+					return
+				}
+				if (this.$isEmpty(this.form.pointValue)) {
+					this.$u.toast('请输入积分值')
+					return
+				}
+				if (this.$isEmpty(this.form.consumeOnePoint)) {
+					this.$u.toast('请输入积分规则')
+					return
+				}
+				
+				this.form.id=this.vuex_mallId
+				this.$api.memberCenter.create(this.form).then(res=>{
+					if (res.success) {
+						this.$dialog.showModal('创建成功',false).then(res=>{
+							this.$jump('/pages/member-center/member-center')
+						})
+					}else{
+						this.$u.toast(res.msg)
+					}
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	page{
+		background-color: #F4F5F7;
+	}
+	
+	.bg-color{
+		background-color: #EE9230;
+		color: #FFFFFF;
+	}
+	
+	.build_title{
+		color: #EE9230;
+		font-size: 32rpx;
+	}
+	
+	.card{
+		border-radius: 24rpx;
+		background-color: #FFFFFF;
+		padding:25rpx 40rpx;
+		display: flex;
+		flex-direction: column;
+		
+		.title{
+			font-weight: 800;
+			font-size: 32rpx;
+			margin-bottom: 20rpx;
+		}
+		
+		.sub_title{
+			font-size: 24rpx;
+			color: #999;
+			margin-left: 10rpx;
+		}
+		
+		
+		.desc{
+			font-size: 26rpx;
+			color: #666666;
+		}
+	}
+</style>

+ 147 - 37
pages/member-center/member-center.vue

@@ -1,68 +1,178 @@
 <template>
 	<view>
-		<view class="top-menu">
-			<view class="">
-				<text>1600</text>
-				<text>会员数量</text>
-			</view>
+		<view class="empty-page" v-if="!isOpenMember">
+			<image src="../../static/icon/vip.png" mode=""></image>
+			<text>没有会员中心信息</text>
 
-			<view class="">
-				<text>1600.00</text>
-				<text>积分总价值</text>
+			<view class="cu-btn btn-bg-color round" style="width: 48%;height: 80rpx;position: fixed;bottom: 20%;">
+				<u-icon name="plus-circle" size="40"></u-icon>
+				<text class="margin-left-10 text-lg">创建会员中心</text>
 			</view>
 		</view>
-		<view class="padding-20 text-bold text-xl">
-			<text>会员列表</text>
-		</view>
 
-		<view class="card">
-			<view class="flex">
-				<view class="area1 title">
-					会员名称
+		<block v-else>
+			<view class="top-menu">
+				<view class="">
+					<text>{{detail.memberCount}}</text>
+					<text>会员数量</text>
 				</view>
-				<view class="area2 title">
-					积分数
-				</view>
-				<view class="area3 title">
-					价值
+
+				<view class="">
+					<text>{{detail.totalPointValue}}</text>
+					<text>积分总价值</text>
 				</view>
 			</view>
+			<view class="padding-20 text-bold text-xl">
+				<text>会员列表</text>
+			</view>
 
-			<view class="item" v-for="(item,index) in 4" :key="index">
-				<view class="area1 flex text-bold">
-					<image class="img-avatar" src="https://thirdwx.qlogo.cn/mmopen/vi_32/q6EwR5U6zFp8bYbUWb9HmFc5Q3R88x13Q0ZtOcVK5lO8AmtibQDRcuMA2Y7CmyuMCr6icceM3QibIKN2icAAxSvjpA/132"></image>
-					<view class="center padding-left-10">
-						<text>会员 123456</text>
+			<view class="card">
+				<view class="flex">
+					<view class="area1 title">
+						会员名称
+					</view>
+					<view class="area2 title">
+						积分数
+					</view>
+					<view class="area3 title">
+						价值
 					</view>
 				</view>
-				<view class="area2 center text-bold text-lg" style="justify-content: flex-start;margin-left: 10rpx;color: #F37A1E;">
-					<image class="img-points" src="../../static/icon/points-value.png"></image>
-					<text class="margin-left-10">-100</text>
-				</view>
-				
-				<view class="area3  center text-lg" >
-					<text class="text-price text-bold">10</text>
-				</view>
-			</view>
 
-		</view>
+				<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
+					:down="downOption" :up="upOption">
+					<view class="item" v-for="(item,index) in dataList" :key="index">
+						<view class="area1 flex text-bold">
+							<image class="img-avatar" :src="item.avatar">
+							</image>
+							<view class="center padding-left-10">
+								<text>{{item.nickName}}</text>
+							</view>
+						</view>
+						<view class="area2 center text-bold text-lg"
+							style="justify-content: flex-start;margin-left: 10rpx;color: #F37A1E;">
+							<image class="img-points" src="../../static/icon/points-value.png"></image>
+							<text class="margin-left-10">{{item.pointTotal | numFilter}}</text>
+						</view>
+
+						<view class="area3  center text-lg">
+							<text class="text-price text-bold">{{item.pointValue | numFilter}}</text>
+						</view>
+					</view>
+				</mescroll-body>
+			</view>
+		</block>
 	</view>
 </template>
 
 <script>
+	import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
 	export default {
+		mixins: [MescrollMixin],
 		data() {
 			return {
-
+				isOpenMember: false,
+				detail: {},
+				dataList: [],
+
+				downOption: {
+					use: false,
+					auto: false // 不自动加载
+				},
+				upOption: {
+					use: false,
+					auto: false // 不自动加载
+				},
 			}
 		},
-		methods: {
+		onLoad() {
+			this.fetchShopDetail()
+		},
+		filters: {
+			numFilter(value) {
+				let realVal = "";
+				if (!isNaN(value) && value !== "") {
+					// 截取当前数据到小数点后两位,改变toFixed的值即可截取你想要的数值
+					realVal = parseFloat(value).toFixed(2);
+				} else {
+					realVal = "--";
+				}
+				return realVal;
+			},
+		},
 
+		methods: {
+			fetchShopDetail() {
+				let params = {
+					id: this.vuex_mallId
+				}
+				this.$api.mall.detail(params).then(res => {
+					if (res.data.isOpenMember == 1) {
+						this.isOpenMember = true
+						this.detail = res.data
+						//加载会员中心
+						this.useOption()
+					}
+				})
+			},
+			downCallback() {
+				setTimeout(() => {
+					this.mescroll.resetUpScroll();
+				}, 800)
+			},
+			useOption() {
+				this.downOption = {
+					use: true,
+					auto: true
+				}
+				this.upOption = {
+					use: true,
+					auto: true
+				}
+			},
+			upCallback(mescroll) {
+				let params = {
+					mallId: this.vuex_mallId,
+					current: mescroll.num,
+					size: mescroll.size,
+				}
+				try {
+					this.$api.memberCenter.list(params).then(res => {
+						let data = res.data.records
+						let total = res.data.total
+						mescroll.endBySize(data.length, total);
+						if (mescroll.num == 1) this.dataList = []; //如果是第一页需手动制空列表
+						this.dataList = this.dataList.concat(data); //追加新数据
+					})
+				} catch (e) {
+					this.mescroll.endErr()
+				}
+			}
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
+	.btn-bg-color {
+		background-color: #EE9230;
+		color: #FFFFFF;
+	}
+
+	.empty-page {
+		height: 50vh;
+		display: flex;
+		justify-content: center;
+		flex-direction: column;
+		align-items: center;
+		color: #CCCCCC;
+
+		image {
+			width: 120rpx;
+			height: 120rpx;
+			margin-bottom: 20rpx;
+		}
+	}
+
 	.top-menu {
 		border-radius: 20rpx;
 		margin: 30rpx 20rpx;

+ 13 - 11
pages/publish/detail.vue

@@ -41,14 +41,14 @@
 				<text class="margin-left-10">联营积分全场通用</text>
 			</view>
 		</view>
-		
+
 		<view class="intro" v-if="current==1">
 			<view class="flex">
 				<u-icon name="coupon"></u-icon>
 				<text class="margin-left-10">商场活动补贴</text>
 			</view>
 			<view class="desc" style="display: flex;border-bottom: 1rpx solid #DDDDDD;align-items: center;">
-				<u-input v-model="value" placeholder="请输入折扣" style="width: 90%;"/>
+				<u-input v-model="appendSupplyPrice" placeholder="请输入折扣" style="width: 90%;" />
 				<text class="padding-left-20">%</text>
 			</view>
 		</view>
@@ -63,7 +63,7 @@
 			</view>
 		</view>
 
-		<view class="attend">
+		<view class="attend" v-if="!$isEmpty(detail.activityJoinRecords)">
 			<view class="margin-bottom-20">
 				<u-icon name="calendar-fill"></u-icon>
 				<text class="margin-left-10">已参加</text>
@@ -71,17 +71,17 @@
 
 			<view class="flex">
 				<view class="flex " style="width: 90%;">
-					<view class="data" v-for="(item,index) in 3" :key="index">
+					<view class="data" v-for="(item,index) in detail.activityJoinRecords" :key="index">
 						<view class="item">
-							<image src="../../static/del/del2.png" mode=""></image>
+							<image :src="item.joinPic" mode=""></image>
 							<view>
 								<text>{{name | ellipsis}}</text>
-								<text>0.5折</text>
+								<text>{{item.finalSupplyPrice}}折</text>
 							</view>
 						</view>
 					</view>
 				</view>
-				<view class="center" style="width: 10%;margin-right: 15rpx;">
+				<view v-if="detail.activityJoinRecords.length>3" class="center" style="width: 10%;margin-right: 15rpx;">
 					<u-icon name="more-circle" size="80" color="#ababab"></u-icon>
 				</view>
 			</view>
@@ -131,7 +131,8 @@
 				current: 0, //0 发起活动详情,1可参加活动详情,2已参加活动详情
 				transparent: '',
 				name: '星巴克',
-				detail: {}
+				detail: {},
+				appendSupplyPrice: 100
 			}
 		},
 		onLoad(options) {
@@ -166,11 +167,12 @@
 			},
 			join() {
 				this.$dialog.showModal("确定参加?").then(res => {
-					let operateList = [{
+					let operateList = {
 						activityId: this.id,
 						joinType: 1,
-						joinId: this.vuex_mallId
-					}]
+						joinId: this.vuex_mallId,
+						appendSupplyPrice: this.appendSupplyPrice
+					}
 					this.$api.activity.join(operateList).then(res => {
 						if (res.success) {
 							this.$dialog.showModal("参加成功", false).then(() => {

+ 1 - 1
pages/stores/stores.vue

@@ -12,7 +12,7 @@
 		<view class="bg-white padding-20">
 			<u-tabs :list="tagsList" active-color="#FF9447" :is-scroll="true" :current="current" @change="change">
 			</u-tabs>
-			<view class="padding-top-10">
+			<view class="padding-top-10" v-if="areaList">
 				<scroll-view scroll-x class="bg-white" style="white-space: nowrap;" scroll-with-animation>
 					<view @click="selectArea(index)" v-for="(item,index) in areaList" :key="index" class="cu-tag"
 						:style="areaIndex==index?'background-color: #FFA66D;color: #FFFFFF;':'background-color: #F5F5F6;color: #6C6C6C;'"

BIN
static/icon/vip.png