| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- <template>
- <view>
- <u-navbar :custom-back="back" title="会员中心"></u-navbar>
-
- <view v-show="!loading">
- <view class="empty-page" v-if="!isOpenMember">
- <image src="../../static/icon/huiyuan1.png" mode=""></image>
- <text style="color: #303030;font-weight: 800;font-size: 32rpx;margin-top: 25rpx;">创建会员中心</text>
- <text style="color: #888888;font-size: 26rpx;margin-top: 20rpx;">设置积分价值、积分规则</text>
- <text style="color: #888888;font-size: 26rpx;margin-top: 10rpx;">实时查看会员信息和积分情况</text>
-
- <view @click="$jump('/pages/member/add')" class="cu-btn btn-bg-color round" style="width: 48%;height: 80rpx;position: fixed;bottom: 40%;">
- <u-icon name="plus-circle-fill" size="40"></u-icon>
- <text class="margin-left-10 text-lg">创建会员中心</text>
- </view>
- </view>
-
- <block v-else>
- <view class="top-menu">
- <!-- <view class="leftFixed"> 1 积分等于 {{detail.pointUnitValue}} 元</view> -->
- <view class="u-flex u-row-between">
- <view class="item">
- <text>{{detail.memberNum}}</text>
- <text>会员数量</text>
- </view>
-
- <view class="item">
- <text>{{detail.totalPointValue}}</text>
- <text>积分总价值</text>
- </view>
- </view>
- <view class="u-m-t-50 u-flex u-col-center u-row-center">
- <text class="u-font-24 u-m-r-20">规则:消费 1 元赠送 {{detail.pointUnitValue}} 元</text>
- <view class="cu-btn bg-white sm round" @click="changeRule" style="padding: 10rpx 20rpx;">
- 更改规则
- </view>
- </view>
- </view>
-
- <view class="padding-20 text-bold text-xl">
- <text>会员列表</text>
- </view>
-
- <view class="card">
- <view class="flex tableTitle">
- <view class="area1 title">
- 会员信息
- </view>
- <view class="area2 title">
- 积分数
- </view>
- <view class="area3 title">
- 价值
- </view>
- </view>
- <mescroll-body :height="height" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
- :down="downOption" :up="upOption">
- <view class="item" v-for="(item,index) in dataList" :key="index" @click="jumpDetail(item)">
- <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">{{$digital.keepTwoDecimal(item.pointTotal)}}</text>
- </view>
-
- <view class="area3 center text-lg">
- <text class="text-price text-bold">{{$digital.keepTwoDecimal(item.pointValue)}}</text>
- </view>
- </view>
- </mescroll-body>
- </view>
- </block>
-
- <view v-if="isOpenMember&&$isNotEmpty(detail.memberNum)">
- <view class="" style="height: 40rpx;"></view>
- <view class="footer-fixed center bg-white padding-top-20" :style="{'paddingBottom':safeAreaBottom}" >
- <view @click="$jump('/pages/notice/notice')" class="cu-btn bg-btn radius" style="width: 80%;height: 80rpx;">
- <u-icon name="chat" size="40"></u-icon>
- <text class="margin-left-10">群发消息</text>
- </view>
- </view>
- </view>
- </view>
-
- <u-popup v-model="showPopup" mode="center" border-radius="20">
- <view class="u-popup-content">
- <text>更改积分规则</text>
- <u-form>
- <u-form-item label-width="170" label="消费1元赠送">
- <u-input type="digit" height="50" :border="true" :clearable="false" v-model="sendPointUnit" placeholder="请输入积分数"/>
- <view slot="right" class="cu-tag btn-bg-color radius">
- 积分
- </view>
- </u-form-item>
- </u-form>
- <u-button size="medium" shape="circle" :custom-style="customStyle1" @click="update">确定</u-button>
- <u-button size="medium" shape="circle" :custom-style="customStyle2" @click="showPopup=false">取消</u-button>
- </view>
- </u-popup>
- <toast ref="toast" ></toast>
- <loading ref="loading" type="3" />
- </view>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-body/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin],
- data() {
- return {
- loading:true,
-
- isOpenMember: false,
- detail: {},
- dataList: [],
-
- height:'300px',
- downOption: {
- use: false,
- auto: false // 不自动加载
- },
- upOption: {
- use: true,
- auto: false // 不自动加载
- },
- showPopup:false,
- //消费一元赠送的积分值
- sendPointUnit:'',
- customStyle1:{
- padding:'40rpx',
- backgroundColor:'#F39248',
- color:'#fff',
- marginBottom:'20rpx',
- width:'350rpx'
- },
- customStyle2:{
- padding:'40rpx',
- width:'350rpx'
- },
- }
- },
- watch:{
- mescroll(){
- if (this.isOpenMember) {
- this.mescroll.resetUpScroll();
- }
- }
- },
- onReady() {
- this.getElInfo()
- },
- onLoad() {
- this.$refs.loading.showLoading()
- this.fetchMemberInfo()
- },
- methods: {
- changeRule(){
- uni.navigateTo({
- url:"./add?type='change'"
- })
- },
- back(){
- uni.reLaunch({
- url:"/pages/index/index"
- })
- },
- update(){
- let params = {
- id: this.vuex_shopId,
- sendPointUnit:this.sendPointUnit
- }
- this.$api.shop.submit(params).then(res => {
- this.fetchMemberInfo()
- this.showPopup = false
- })
- },
- async getElInfo() {
- let rectInfo = await this.$u.getRect('.tableTitle');
- this.height=this.$u.sys().windowHeight - rectInfo.top + 'px'
- },
- async fetchMemberInfo(){
- let params={
- shopId:this.vuex_shopId
- }
- let res=await this.$api.shop.memberInfo(params)
- if (res.data.isOpenMember == 1) {
- this.isOpenMember = true
- this.detail = res.data
- }else{
- this.loading=false
- this.$refs.loading.hide()
- }
- },
- downCallback() {
- setTimeout(()=>{
- this.mescroll.resetUpScroll();
- },800)
- },
- upCallback(mescroll) {
- let params = {
- shopId: this.vuex_shopId,
- current: mescroll.num,
- size: 30,
- //商店会员
- type:'SHOP'
- }
- try {
- this.$api.member.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); //追加新数据
- this.loading=false
- this.$refs.loading.hide()
- })
- } catch (e) {
- this.loading=false
- this.$refs.loading.hide()
- this.mescroll.endErr()
- }
- },
- jumpDetail(item){
- let params={
- userId:item.userId,
- id:item.id
- }
- uni.navigateTo({
- url:"/pages/member/detail"+this.$u.queryParams(params)
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
-
- .bg-btn{
- background-color: #F39248;
- color: #FFFFFF;
- }
-
- .empty-page {
- height: 600rpx;
- display: flex;
- justify-content: center;
- flex-direction: column;
- align-items: center;
- image {
- width: 160rpx;
- height: 160rpx;
- margin-bottom: 20rpx;
- }
- }
- .top-menu {
- border-radius: 20rpx;
- margin: 20rpx 20rpx;
- padding: 40rpx;
- background-image: linear-gradient(to right, #272A46, #30355D);
- color: #fff;
- position: relative;
- .leftFixed{
- padding:0 10rpx;
- font-size: 22rpx;
- height: 40rpx;
- line-height: 40rpx;
- background-color: $color;
- color: #fff;
- position: absolute;
- top: 20rpx;
- left: 0;
- border-top-right-radius: 25px;
- border-bottom-right-radius: 25px;
- }
- .item {
- display: flex;
- flex-direction: column;
- text-align: center;
- align-items: center;
- justify-content: center;
- flex:1;
- margin-top: 40rpx;
- text:first-child {
- margin-bottom: 5rpx;
- color: #FFFFFF;
- font-weight: 800;
- font-size: 38rpx;
- }
- text:last-child {
- font-size: 26rpx;
- color: #D0D4EE;
- }
- }
- }
-
- .u-popup-content{
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 30rpx;
- u-form{
- margin: 60rpx 0;
- width: 500rpx;
- }
- }
-
- .card {
- width: 100%;
- background-color: #FFFFFF;
- padding: 30rpx;
- font-size: 26rpx;
- .text-area {
- display: flex;
- justify-content: flex-start;
- align-items: center;
- }
- .title {
- padding-left: 20rpx;
- color: #666666;
- }
- .area1 {
- width: 50%;
- }
- .area2 {
- width: 30%;
- }
- .area3 {
- width: 20%;
- }
- .item {
- padding: 30rpx 20rpx;
- display: flex;
- border-bottom: 1rpx solid #DDDDDD;
- .img-avatar {
- width: 70rpx;
- height: 70rpx;
- border-radius: 50%;
- }
- .img-points {
- width: 35rpx;
- height: 35rpx;
- }
- }
- }
- </style>
|