shish 4 år sedan
förälder
incheckning
16473e8f97

+ 197 - 0
ghsApp/src/admin/hb/tjFl.vue

@@ -0,0 +1,197 @@
+<template>
+	<view class="ex-page">
+        <view class="title">
+            活动状态:<switch style="transform: scale(0.8,0.8)" :checked="rechargeSwitch == 0 ? false : true" @change="rechargeChange" />
+            <text v-if="rechargeSwitch == 0">关闭</text><text v-else>开启</text>
+            <button class="admin-button-com middle blue" @click="addHb()">新增选项</button>
+        </view>
+        <view class="recharge-list">
+
+            <view v-for="(item, index) in recharge" :key="index">
+
+                <view class="item">
+
+                    <view>充值金额:<input v-model="item.amount" @click="discount=''" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />元</view>
+                    <view>赠送红包:<input v-model="item.num" @click="discount=''" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />个</view>
+                    <view>每个红包:<input v-model="item.hbAmount" @click="discount=''" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0rpx 10rpx;" />元</view>
+                    <view>最低消费:<input v-model="item.miniExpend" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />元可用</view>
+                    <view>有效时长:<input v-model="item.valid" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />天
+                    <button class="admin-button-com mini default" @click="delHb(item)" style="margin-left:150rpx;">删除</button>
+                    </view>
+
+                </view>
+
+            </view>
+
+        </view>
+
+        <view class="footer">
+            <button class="admin-button-com big blue" @click="saveHb()">保存</button>
+        </view>
+	</view>
+</template>
+<script>
+import { mapGetters } from "vuex";
+import { getRechargeHbDetail,saveRechargeHb } from "@/api/recharge";
+export default {
+	components: {},
+	mixins: [],
+	computed: {
+		...mapGetters({ myShopInfo: "getMyShopInfo" }),
+	},
+	data() {
+		return {
+            recharge:[],
+            rechargeSwitch:0
+		};
+	},
+	onPullDownRefresh() {
+
+	},
+	onLoad() {
+
+	},
+	methods: {
+        rechargeChange(e) {
+			let value = e.target.value
+            if(value){
+                this.rechargeSwitch = 1
+            }else{
+                this.rechargeSwitch = 0
+            }
+        },
+		init(){
+            this.getDetail()
+        },
+        getDetail(){
+            let that = this
+            getRechargeHbDetail().then(res => {
+                that.rechargeSwitch = res.data.recharge;
+                if(!this.$util.isEmpty(res.data.list)){
+                   that.recharge = res.data.list.map(e=>{
+                       return {amount:parseFloat(e.amount),num:e.num,hbAmount:parseFloat(e.hbAmount),miniExpend:parseFloat(e.miniExpend),valid:e.valid}
+                   })
+                }else{
+                    that.recharge = [
+                        {amount:5000,num:2,hbAmount:5,miniExpend:200,valid:30}
+                    ]
+                }
+            });
+        },
+        delHb(item){
+            if(this.recharge.length <= 1){
+                this.$msg("最少需要保留一个")
+                return false
+            }
+            var index = this.recharge.indexOf(item); 
+            if (index > -1) { 
+                this.recharge.splice(index, 1)
+                this.$msg("删除成功")
+            }
+        },
+        addHb(){
+            if(this.recharge.length > 6){
+                this.$msg("最多只能设置6个")
+                return false
+            }
+            this.recharge.push({amount:'',num:'',hbAmount:'',miniExpend:'',valid:''})
+        },
+        saveHb(){
+            let amountGroup = []
+            let hasError = false
+            this.recharge.forEach(e => {
+                let currentAmount = parseFloat(e.amount)
+                if(amountGroup.indexOf(currentAmount) > -1){
+                   this.$msg("充值金额"+currentAmount+"重复了")
+                   hasError = true
+                   return false
+                }
+                amountGroup.push(currentAmount)
+
+                if(this.$util.isMoney(e.num) == false || e.num%1 !== 0){
+                   this.$msg("请填写红包数量")
+                   hasError = true
+                   return false
+                }
+
+                if(this.$util.isMoney(e.valid) == false || e.valid%1 !== 0){
+                   this.$msg("请填写有效期")
+                   hasError = true
+                   return false
+                }
+
+                if(this.$util.isMoney(e.hbAmount) == false){
+                   this.$msg("请填写红包金额"+e.hbAmount)
+                   hasError = true
+                   return false
+                }
+
+                if(this.$util.isMoney(e.miniExpend) == false){
+                   this.$msg("请填写最低消费金额")
+                   hasError = true
+                   return false
+                }
+                if(Number(e.miniExpend) <= Number(e.hbAmount)){
+                   uni.showToast({title: '最低消费金额要大于红包金额',duration: 3000,icon:"none"})
+                   hasError = true
+                   return false
+                }
+            });
+            if(hasError){
+                return false
+            }
+            saveRechargeHb({data:JSON.stringify(this.recharge),rechargeSwitch:this.rechargeSwitch}).then(res=>{
+                if(res.code == 1){
+                    this.$msg(res.msg)
+                    setTimeout(() => {
+                        this.$util.pageTo(1);
+                    }, 1000);
+                }
+            })
+        }
+	}
+};
+</script>
+<style lang="scss" scoped>
+.ex-page{
+    .title{
+        position: fixed;
+        z-index:999999;
+        padding-left:20rpx;
+        font-size:30rpx;
+        background:white;
+        width:100%;
+        button{
+            position: fixed;
+            right:10rpx;
+        }
+    }
+    .recharge-list{
+        line-height:80px;
+        padding-left:20rpx;
+        font-size:30rpx;
+        padding-bottom:100rpx;
+        padding-top:110rpx;
+        .item{
+            margin-bottom:60rpx;
+            input{
+                height:18rpx;
+            }
+        }
+    }
+    .footer{
+        margin-top:50rpx;
+        text-align: center;
+        position: fixed;
+        bottom:0;
+        width:100%;
+        background:#FFFFFF;
+        z-index:99999;
+        button{
+            width:90%;
+            margin:0 auto;
+        }
+
+    }
+}
+</style>

+ 197 - 0
ghsApp/src/admin/hb/xrFl.vue

@@ -0,0 +1,197 @@
+<template>
+	<view class="ex-page">
+        <view class="title">
+            新客到店福利:<switch style="transform: scale(0.8,0.8)" :checked="xrFlSwitch == 0 ? false : true" @change="flChange" />
+            <text v-if="xrFlSwitch == 0">关闭</text><text v-else>开启</text>
+            <button class="admin-button-com middle blue" @click="addXrFl()">新增选项</button>
+        </view>
+        <view class="xrFl-list">
+
+            <view v-for="(item, index) in xrFl" :key="index">
+
+                <view class="item">
+
+                    <view>赠送红包:<input v-model="item.num" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />个</view>
+                    <view>每个红包:<input v-model="item.hbAmount" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0rpx 10rpx;" />元</view>
+                    <view>最低消费:<input v-model="item.miniExpend" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />元可用</view>
+                    <view>有效时长:<input v-model="item.valid" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />天
+                    <button class="admin-button-com mini default" @click="delXrFl(item)" style="margin-left:150rpx;">删除</button>
+                    </view>
+
+                </view>
+
+            </view>
+
+        </view>
+
+        <view class="footer">
+            <button class="admin-button-com big blue" @click="saveXrFl()">保存</button>
+        </view>
+	</view>
+</template>
+<script>
+import { mapGetters } from "vuex";
+import { getDetail,saveXrFl } from "@/api/xr-fl";
+export default {
+	components: {},
+	mixins: [],
+	computed: {
+		...mapGetters({ myShopInfo: "getMyShopInfo" }),
+	},
+	data() {
+		return {
+            xrFl:[],
+            xrFlSwitch:0
+		};
+	},
+	onPullDownRefresh() {
+
+	},
+	onLoad() {
+
+	},
+	methods: {
+        flChange(e) {
+			let value = e.target.value
+            if(value){
+                this.xrFlSwitch = 1
+            }else{
+                this.xrFlSwitch = 0
+            }
+        },
+		init(){
+            this.getDetail()
+        },
+        getDetail(){
+            let that = this
+            getDetail().then(res => {
+                that.xrFlSwitch = res.data.xrFl;
+                if(!this.$util.isEmpty(res.data.list)){
+                   that.xrFl = res.data.list.map(e=>{
+                       return {num:e.num,hbAmount:parseFloat(e.hbAmount),miniExpend:parseFloat(e.miniExpend),valid:e.valid}
+                   })
+                }else{
+                    that.xrFl = [
+                        {num:2,hbAmount:20,miniExpend:200,valid:10}
+                    ]
+                }
+            });
+        },
+        delXrFl(item){
+            if(this.xrFl.length <= 1){
+                this.$msg("最少要一个")
+                return false
+            }
+            var index = this.xrFl.indexOf(item); 
+            if (index > -1) { 
+                this.xrFl.splice(index, 1)
+                this.$msg("删除成功")
+            }
+        },
+        addXrFl(){
+            if(this.xrFl.length > 5){
+                this.$msg("最多只能设置5个")
+                return false
+            }
+            this.xrFl.push({num:'',hbAmount:'',miniExpend:'',valid:''})
+        },
+        saveXrFl(){
+            let hasError = false
+            let hbAmountGroup = []
+            this.xrFl.forEach(e => {
+
+                let currentAmount = parseFloat(e.hbAmount)
+                if(hbAmountGroup.indexOf(currentAmount) > -1){
+                   this.$msg("红包金额"+currentAmount+"重复了")
+                   hasError = true
+                   return false
+                }
+                hbAmountGroup.push(currentAmount)
+
+                if(this.$util.isMoney(e.num) == false || e.num%1 !== 0){
+                   this.$msg("请填写红包数量")
+                   hasError = true
+                   return false
+                }
+
+                if(this.$util.isMoney(e.valid) == false || e.valid%1 !== 0){
+                   this.$msg("请填写有效期")
+                   hasError = true
+                   return false
+                }
+
+                if(this.$util.isMoney(e.hbAmount) == false){
+                   this.$msg("请填写红包金额"+e.hbAmount)
+                   hasError = true
+                   return false
+                }
+
+                if(this.$util.isMoney(e.miniExpend) == false){
+                   this.$msg("请填写最低消费金额")
+                   hasError = true
+                   return false
+                }
+                if(Number(e.miniExpend) <= Number(e.hbAmount)){
+                   uni.showToast({title: '最低消费金额要大于红包金额',duration: 3000,icon:"none"})
+                   hasError = true
+                   return false
+                }
+            });
+            if(hasError){
+                return false
+            }
+            saveXrFl({data:JSON.stringify(this.xrFl),xrFlSwitch:this.xrFlSwitch}).then(res=>{
+                if(res.code == 1){
+                    this.$msg(res.msg)
+                    setTimeout(() => {
+                        this.$util.pageTo(1);
+                    }, 1000);
+                }
+            })
+        }
+	}
+};
+</script>
+<style lang="scss" scoped>
+.ex-page{
+    .title{
+        position: fixed;
+        z-index:999999;
+        padding-left:20rpx;
+        font-size:30rpx;
+        background:white;
+        width:100%;
+        button{
+            position: fixed;
+            right:10rpx;
+        }
+    }
+    .xrFl-list{
+        line-height:80px;
+        padding-left:20rpx;
+        font-size:30rpx;
+        padding-bottom:100rpx;
+        padding-top:110rpx;
+        .item{
+            margin-bottom:60rpx;
+            input{
+                height:18rpx;
+            }
+        }
+    }
+    .footer{
+        margin-top:50rpx;
+        text-align: center;
+        position: fixed;
+        bottom:0;
+        width:100%;
+        background:#FFFFFF;
+        z-index:99999;
+        button{
+            width:90%;
+            margin:0 auto;
+        }
+
+    }
+}
+</style>

+ 5 - 4
ghsApp/src/admin/home/apply.vue

@@ -34,10 +34,11 @@ export default {
                 {
                     title:'营销推广',
                     list:[
-                        {name: "红包",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/hb/list"},
-                        {name: "充值返利",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/item/rechargeHb"},
-                        {name: "充值客户",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/hb/rechargeList"},
-                        {name: "邀请开店",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/pagesInvite/list"}
+                        {name: "新客福利",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/hb/xrFl"},
+                        {name: "推荐福利",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/hb/tjFl"},
+                        {name: "充值福利",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/item/rechargeHb"},
+                        {name: "充值记录",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/hb/rechargeList"},
+                        {name: "已发红包",img: `${this.$constant.imgUrl}/ghs/home/yqyl.png`,url: "/admin/hb/list"}
                     ]
                 },
                 {

+ 1 - 1
ghsApp/src/admin/setting/coupon.vue

@@ -9,7 +9,7 @@
 		<div class="module-com new_wrap">
 			<div class="module-det">
 				<div>
-					<span>新注册会员送</span>
+					<span>新注册会员送</span>
 					<input type="text" class="setting-inp" v-model="form.amount" />
 					<span>元优惠券,满</span>
 					<input type="text" class="setting-inp" v-model="form.miniCost" />

+ 1 - 1
ghsApp/src/api/coupon/index.js

@@ -31,7 +31,7 @@ export const getListB = data => {
 }
 
 /** *
- * 新优惠券设置的详情 b
+ * 新优惠券设置的详情 b
  */
 export const couponAssetDet = data => {
 	return https.get('/coupon-asset/detail', data)

+ 9 - 0
ghsApp/src/api/xr-fl/index.js

@@ -0,0 +1,9 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+export const getDetail = data => {
+	return https.get('/xr-fl/detail', data)
+}
+
+export const saveXrFl = async data => {
+	return https.post("/xr-fl/save-fl", data);
+}

+ 3 - 1
ghsApp/src/pages.json

@@ -536,7 +536,9 @@
 			"root": "admin/hb",
 			"pages": [
 				{"path": "list","style": {"navigationBarTitleText": "红包"}},
-				{"path": "rechargeList","style": {"navigationBarTitleText": "充值记录"}}
+				{"path": "rechargeList","style": {"navigationBarTitleText": "充值记录"}},
+				{"path": "xrFl","style": {"navigationBarTitleText": "新客到店福利"}},
+				{"path": "tjFl","style": {"navigationBarTitleText": "推荐新客福利"}}
 			]
 		},
 		{

+ 1 - 1
hdApp/src/admin/coupon/couponList.vue

@@ -27,7 +27,7 @@
 						<div class="list-det-right">
 							<div class="coupon-message">
 								<div class="app-color-2" style="color:#333333;font-weight:500;font-size:35rpx;">{{ item.name}}</div>
-								<div>来源:{{item.ghsName}}</div>
+								<div>{{item.ghsName}}专用</div>
 								<div>过期时间:{{ item.endTime.substr(0, 10) }}</div>
 							</div>
 							<!-- 未使用 -->

+ 5 - 0
hdApp/src/api/hb/index.js

@@ -0,0 +1,5 @@
+import https from '@/plugins/luch-request_0.0.7/request'
+
+export const getNewGift = data => {
+	return https.get('/hb/get-new-gift', data)
+}

+ 10 - 7
hdApp/src/components/module/app-activily-coupon.vue

@@ -18,8 +18,8 @@
 					</div>
 					<div class="list-det-right">
 						<div class="coupon-message">
-							<div class="app-color-2" style="font-weight:700;font-size:40rpx;margin-bottom:10rpx;margin-left:18rpx;">到店红包</div>
-							<div style="font-size:30rpx;margin-left:30rpx;">本店专用</div>
+							<div class="app-color-2" style="font-weight:700;font-size:40rpx;margin-bottom:10rpx;margin-left:40rpx;">到店红包</div>
+							<div style="font-size:30rpx;margin-left:55rpx;">本店专用</div>
 						</div>
 					</div>
 				</div>
@@ -29,7 +29,7 @@
 </template>
 <script>
 import ModalModule from '@/components/plugin/modal'
-import { receiveGift } from '@/api/coupon'
+import { getNewGift } from '@/api/hb'
 export default {
 	name: 'app-activily-coupon',
 	components: {
@@ -61,10 +61,13 @@ export default {
 				this.$msg('稍等2秒')
 				return false
 			}
-			receiveGift({ghsId: this.ghsId}).then(res => {
-				if(res.code == 0){
-					that.$msg('领取成功')
+			getNewGift({ghsId: this.ghsId}).then(res => {
+				that.$msg(res.msg)
+				if(res.code == 1){
 					that.modalCancel()
+					setTimeout(function(){
+						that.$util.pageTo({url: '/admin/coupon/couponList',type:3})
+					},1500)
 				}
 			})
 		},
@@ -130,4 +133,4 @@ export default {
 			}
 		}
 	}
-</style>
+</style>

+ 32 - 33
hdApp/src/pagesPurchase/ghsProduct.vue

@@ -5,9 +5,10 @@
       <view class="header_inside">
         <image :src="ghsInfo.avatar"></image>
         <view class="shop_info">
+
 			<view class="shop_title" @click="pageTo({url:'/pagesPurchase/level?id='+ghsInfo.id})">
 				{{ghsInfo.name}}
-				<text class="level">{{ghsInfo.giveLevelName}}</text>
+				<text class="level">{{ghsInfo.giveLevelName||'大众会员'}}</text>
 			</view>
 
 			<view v-if="ghsInfo.hasRechargeHb && ghsInfo.hasRechargeHb ==1" class="shop_intro" @tap="recharge(ghsInfo)">
@@ -97,31 +98,26 @@
 				</view>
 			</template>
 		</modal-module>
-		<modal-module
-			:show="true"
-
-			:title="'aaaa'"
-			color="#333"
-			:size="32"
-			padding="30rpx 30rpx"
-		>
 
+		<modal-module :show="showInvite" color="#333" :size="32" padding="60rpx 30rpx" width="94%" :button="[]">
 			<template slot="customContent">
-				<view class="select-cmd_bx">
-					<view class="num_bx">
-							aaaa
+				<view>
+					<view style="margin-bottom:60rpx;margin-top:20rpx;font-size:30rpx;">邀新人下单,您得30元红包,新人得100元红包</view>
+					<view>
+						<button style="padding-left:85rpx;padding-right:85rpx;" class="admin-button-com default big" @click="closeInvite()">取消</button>
+						<button style="padding-left:150rpx;padding-right:150rpx;margin-left:30rpx;" class="admin-button-com blue big" @click="closeInvite()" open-type="share">邀请</button>
 					</view>
 				</view>
 			</template>
-
 		</modal-module>
+
 		<FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent" ></FooterCart>
 		<wangCg :show.sync="notOpenShop" @bthClick="toPage"></wangCg>
     	<sel-popup :show="popupShow" :info="infoData" @close="hidePopup" />
 
 		<app-activily-coupon
-		:show.sync="isNewMan"
-		:info="newUserGift"
+		:show.sync="isNewCustom"
+		:info="newCustomGift"
 		:ghsId="ghsId"
 		/>
 
@@ -191,9 +187,10 @@ export default {
 			xjData:{},
 			xjDataInfo:{},
 			shareDiscount:1,
-			isNewMan:false,
 			ghsId:0,
-			newUserGift:{amount:100,miniCost:500,validTime:'2021-12-05'}
+			newCustomGift:{amount:100,miniCost:500,validTime:'2021-12-05'},
+			isNewCustom:false,
+			showInvite:false
 		};
 	},
 	onPullDownRefresh() {
@@ -293,17 +290,11 @@ export default {
 
 	},
 	methods: {
+		closeInvite(){
+			this.showInvite = false
+		},
 		invite(){
-			uni.showModal({
-				title: '提示',
-				content: '邀新人下单您得30元红包,新人得100元红包',
-				confirmText:'去邀请',
-				success: function (res) {
-					if (res.confirm) {
-
-					}
-				}
-			})
+			this.showInvite = true
 		},
 		recharge(item){
 			this.$util.pageTo({url:'/pagesStore/me/recharge',query:{ghsId:item.id}})
@@ -371,6 +362,12 @@ export default {
 					this.createShareDiscount()
 					uni.setNavigationBarTitle({title: this.ghsInfo.name})
 					this.option.id = res.data.id;
+					//不是新人或者已经下过单的不再显示新人红包
+					if(res.hasCg > 0 || res.new == 0){
+						this.isNewCustom = false
+					}else{
+						this.isNewCustom = true
+					}
 				}).catch(err => {})
 			} else {
 				this.ghsId = this.option.id
@@ -381,9 +378,13 @@ export default {
 					this.shopId = res.data.shopId
 					this.visitMall(this.option.id)
 					this.createShareDiscount()
-					uni.setNavigationBarTitle({
-						title: this.ghsInfo.name
-					})
+					uni.setNavigationBarTitle({title: this.ghsInfo.name})
+					//不是新人或者已经下过单的不再显示新人红包
+					if(res.hasCg > 0 || res.new == 0){
+						this.isNewCustom = false
+					}else{
+						this.isNewCustom = true
+					}
 				}).catch(err => {})
 			}
 
@@ -787,6 +788,4 @@ export default {
     }
   }
 }
-
-
-</style>
+</style>