diff --git a/config/app.js b/config/app.js index cdcc9f8..c367586 100644 --- a/config/app.js +++ b/config/app.js @@ -39,6 +39,7 @@ switch (env) { wsApi = 'wss://crmeb-test.shop.lihaink.cn' } +const ossUrl = '' // httpApi='' // 聊天接口修改此字符 小程序聊天要求wss 例如:wss://mer.crmeb.net @@ -54,6 +55,7 @@ module.exports = { HTTP_REQUEST_URL_THREE: httpApiThree, HTTP_REQUEST_URL_FOUR: httpApiFour, HTTP_REQUEST_URL_FIVE: httpApiFive, + OSS_URL: ossUrl, VUE_APP_WS_URL: `${wsApi}?type=user`, VUE_APP_WS_URL_ONE:wsApi_one, // #endif diff --git a/pages.json b/pages.json index 7b45427..26c9611 100644 --- a/pages.json +++ b/pages.json @@ -636,6 +636,14 @@ "navigationBarTitleText": "我的账户" } }, + { + "path" : "user_money/money", + "style" : + { + "navigationBarTitleText" : "我的余额", + "enablePullDownRefresh" : false + } + }, { "path": "user_bill/index", "style": { diff --git a/pages/users/user_money/index.vue b/pages/users/user_money/index.vue index 354fa1c..5596e55 100644 --- a/pages/users/user_money/index.vue +++ b/pages/users/user_money/index.vue @@ -10,18 +10,18 @@ <view class='money'>{{userInfo.now_money || 0}}</view> </view> <!-- #ifdef APP-PLUS || H5 --> - <!-- <navigator url="/pages/users/user_payment/index" hover-class="none" class='recharge t-color'>充值</navigator> --> + <navigator url="/pages/users/user_payment/index" hover-class="none" class='recharge t-color'>充值</navigator> <!-- #endif --> <!-- #ifdef MP --> - <!-- <view @click="openSubscribe('/pages/users/user_payment/index')" class='recharge t-color'>充值</view> --> + <view @click="openSubscribe('/pages/users/user_payment/index')" class='recharge t-color'>充值</view> <!-- #endif --> </view> <view class='cumulative acea-row row-top'> <!-- v-if="balance_func_status == 1" --> - <!-- <view class='item' > + <view class='item' > <view>累计充值(元)</view> <view class='money'>{{userInfo.total_recharge || 0}}</view> - </view> --> + </view> <view class='item'> @@ -44,12 +44,12 @@ </view> <view>消费记录</view> </navigator> - <!-- <navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2'> + <navigator class='item' hover-class='none' url='/pages/users/user_bill/index?type=2'> <view class='pictrue'> <image :src="domain+'/static/diy/record3'+keyColor+'.png'"></image> </view> <view>充值记录</view> - </navigator> --> + </navigator> </view> </view> <recommend :hostProduct="hostProduct" :isLogin="isLogin"></recommend> diff --git a/pages/users/user_money/money.vue b/pages/users/user_money/money.vue new file mode 100644 index 0000000..a654c4e --- /dev/null +++ b/pages/users/user_money/money.vue @@ -0,0 +1,386 @@ +<template> + <view class="m_body"> + <view class="head_card"> + <view class="card_img"> + <image class="image" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/22c6320240125134855740.png"></image> + <view class="c_content"> + <view class="c_title">当前余额</view> + <view class="c_count"> <text class="c_icon">¥</text> {{userInfo.now_money||'0.00'}}</view> + </view> + </view> + <view class="c_tab"> + <u-tabs :list="list1" :current="curNow" @click="clickTab1" lineWidth="60rpx" lineColor="#FF8056" + :itemStyle="{width: '200rpx', height: '80rpx'}"></u-tabs> + </view> + </view> + <view class="body_card"> + <view class="card1" v-if="curNow==0"> + <view class="change_list"> + <view class="change_item" :class="{'change_item_active': nowChange==index}" @click="changeItem(item, index)" + v-for="(item, index) in changeList" :key="index"> + <text class="c_icon">¥</text> {{item}} + </view> + </view> + <view class="c_tab"> + <u-tabs :list="[{name: '充值数量'}]" lineWidth="60rpx" lineColor="#FF8056" + :itemStyle="{width: '200rpx', height: '80rpx'}"></u-tabs> + </view> + <view class="change_count"> + <view>当前选择面额 ¥{{nowPrice}}</view> + <view class="c_btn"> + <view @click="reduce">-</view> + <view>{{priceCount}}</view> + <view @click="append">+</view> + </view> + </view> + <view class="c_tips"> + <view class="tips_title">注意事项:</view> + <view>充值后金额不能提现,仅可用于商城商品消费</view> + </view> + </view> + <view class="card2" v-if="curNow==1"> + <view class="record" v-for="(item, index) in recordList" :key="index"> + <view class="left"> + <image src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/e807a202401251520462666.png"></image> + <view> + <view>{{item.title}}</view> + <view class="tips">{{item.create_time}}</view> + </view> + </view> + <view class="right">{{item.number}}</view> + </view> + <view class="no_data" v-if="recordList.length==0">暂无充值记录</view> + </view> + </view> + <view class="footer" v-if="curNow==0"> + <view class="f_tip"> + 总计充值金额: + <view class="price"> + <text>{{total}}</text>元 + </view> + </view> + <view class="primary_btn">确认充值</view> + </view> + <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> + </view> +</template> + +<script> + import { getCommissionInfo } from "@/api/user.js" + import { Toast } from "../../../libs/uniApi"; + import { + mapGetters + } from "vuex"; + import { + getUserInfo + } from '@/api/user.js'; + import authorize from '@/components/Authorize'; + export default { + components:{ + authorize + }, + data() { + return { + userInfo: {}, + curNow: 0, + list1: [{ + name: '余额充值' + }, { + name: '充值记录' + }], + changeList: [10, 15, 20, 50, 100], + nowChange: 0, + nowPrice: 0, + priceCount: 1, + isAuto: false, //没有授权的不会自动授权 + isShowAuth: false, //是否隐藏授权 + recordList: [], + where: { + page: 1, + limit: 15, + type: 2 + } + } + }, + onLoad() { + this.nowPrice = this.changeList[0]; + if (this.isLogin) { + this.getUserInfo() + } else { + this.isAuto = true; + this.isShowAuth = true + } + }, + onShow() {}, + computed: { + ...mapGetters(['isLogin', 'viewColor', 'keyColor']), + total() { + return this.nowPrice * this.priceCount; + } + }, + onReachBottom() { + this.getCommissionInfo(); + }, + methods: { + onLoadFun: function() { + this.isShowAuth = false; + this.getUserInfo(); + }, + getUserInfo() { + getUserInfo().then(res=>{ + this.userInfo = res.data; + }) + }, + clickTab1(e) { + this.curNow = e.index; + if (e.index == 1) { + this.where.page = 1; + this.getCommissionInfo(); + } + }, + changeItem(e, index) { + this.nowPrice = e; + this.nowChange = index; + if (this.priceCount * this.nowPrice > 20000) { + this.priceCount = Math.floor(20000 / this.nowPrice); + return Toast('不可充值超过2万元'); + } + }, + append() { + if (this.priceCount * this.nowPrice > 20000) { + this.priceCount = Math.floor(20000 / this.nowPrice); + return Toast('不可充值超过2万元'); + } else this.priceCount++; + }, + reduce() { + if (this.priceCount <= 1) return Toast('最少充值一份'); + else this.priceCount--; + }, + getCommissionInfo() { + getCommissionInfo(this.where).then((res) => { + if(res.data.list.length>0) { + this.recordList = [...this.recordList, ...res.data.list]; + if(res.data.list.length>=15) this.where.page++; + } + }) + } + }, + onPullDownRefresh() { + uni.stopPullDownRefresh() + } + } +</script> + +<style lang="scss"> + .m_body { + .head_card { + position: relative; + height: 430rpx; + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + background-color: #fff; + + .card_img { + width: 724rpx; + height: 362rpx; + position: relative; + + .image { + width: 100%; + height: 100%; + } + + .c_content { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + padding: 110rpx 60rpx; + color: #fff; + display: flex; + flex-direction: column; + justify-content: space-around; + + .c_title { + font-size: 32rpx; + } + + .c_count { + font-size: 50rpx; + font-weight: bold; + + .c_icon { + font-size: 32rpx; + } + } + } + } + + .c_tab { + position: absolute; + left: 0; + bottom: 0; + width: 100%; + height: 130rpx; + padding: 20rpx 0; + background-color: #fff; + border-radius: 60rpx 60rpx 0 0; + } + } + + .body_card { + color: #333; + + .card1 { + background-color: #fff; + + .change_list { + width: 720rpx; + margin: 0 auto; + display: flex; + flex-wrap: wrap; + + .change_item { + width: 220rpx; + margin: 10rpx; + height: 88rpx; + line-height: 88rpx; + text-align: center; + background-color: #f7f7f7; + border-radius: 20rpx 20rpx 20rpx 20rpx; + font-size: 40rpx; + + .c_icon { + font-size: 28rpx; + } + } + + .change_item_active { + background: rgba(#FF8056, 0.2); + border: 5rpx solid #FF8056; + color: #FF8056; + } + } + + .change_count { + width: 700rpx; + margin: 0 auto; + border-radius: 20rpx; + border: 5rpx solid #FF8056; + color: #FF8056; + display: flex; + justify-content: space-between; + align-items: center; + padding-left: 30rpx; + margin-top: 30rpx; + margin-bottom: 50rpx; + + .c_btn { + display: flex; + + view { + height: 80rpx; + width: 60rpx; + text-align: center; + line-height: 80rpx; + } + } + } + + .c_tips { + width: 700rpx; + margin: 0 auto; + font-size: 26rpx; + color: #616161; + padding-bottom: 30rpx; + + .tips_title { + font-size: 30rpx; + } + } + } + + .card2 { + background-color: #fff; + + .record { + display: flex; + justify-content: space-between; + align-items: center; + padding: 26rpx 20rpx; + border-bottom: 1rpx solid #f7f7f7; + + .left { + display: flex; + + image { + height: 76rpx; + width: 76rpx; + margin-right: 20rpx; + } + + .tips { + font-size: 26rpx; + color: #616161; + } + } + + .right { + font-size: 36rpx; + } + } + + .no_data{ + padding: 60rpx 0; + text-align: center; + border-top: 1rpx solid #f7f7f7; + color: #999; + font-size: 26rpx; + } + } + } + + .footer { + position: fixed; + left: 0; + bottom: 0; + height: 120rpx; + width: 100vw; + background-color: #fff; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 20rpx; + + .f_tip { + display: flex; + align-items: flex-end; + font-style: 26rpx; + + .price { + color: #FF8056; + + text { + font-size: 44rpx; + margin-left: 20rpx; + margin-right: 5rpx; + } + } + + } + + .primary_btn { + background-color: #fa8147; + height: 80rpx; + border-radius: 80rpx; + width: 180rpx; + color: #fff; + line-height: 80rpx; + text-align: center; + } + } + } +</style> \ No newline at end of file