Add 'uniapp/' from commit '096e31448ca089004c78af69f2006c2b0324d8a4'

git-subtree-dir: uniapp
git-subtree-mainline: b87880e247
git-subtree-split: 096e31448c
这个提交包含在:
wikiboss
2026-11-20 09:08:51 +08:00
当前提交 f141d35f1c
共有 341 个文件被更改,包括 73668 次插入 和 0 次删除

查看文件

@@ -0,0 +1,381 @@
<!-- 添加修改地址 -->
<template>
<view class="address-wrap">
<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
<!-- 地址定位 -->
<view v-if="platform != 'App'" class="location-item u-flex u-row-between u-p-20 u-m-b-20" @tap="getLocation">
<view class="u-flex">
<text class="u-iconfont uicon-map-fill" style="#a76f0d;"></text>
<text>{{ chooseAddress }}</text>
</view>
<text class="u-iconfont uicon-arrow-right" style="color: #666"></text>
</view>
<view v-else class="location-item u-flex u-row-between u-p-20 u-m-b-20" @tap="handleOpenAuth('ACCESS_FINE_LOCATION')">
<view class="u-flex">
<text class="u-iconfont uicon-map-fill" style="#a76f0d;"></text>
<text>{{ chooseAddress }}</text>
</view>
<text class="u-iconfont uicon-arrow-right" style="color: #666"></text>
</view>
<view class="address-box">
<!-- 地址表单 -->
<u-form-item :labelStyle="labelStyle"   label-width="150" label-position="left" label="收货人:" prop="consignee">
<u-input placeholder="请填写收货人姓名" v-model="model.consignee" type="text"></u-input>
</u-form-item>
<u-form-item :labelStyle="labelStyle"   label-width="150" label-position="left" label="手机号:" prop="phone">
<u-input placeholder="请输入收货人手机号" v-model="model.phone" type="number"></u-input>
</u-form-item>
<u-form-item :labelStyle="labelStyle" label-width="150" label-position="left" label="所在地区:" prop="area_text">
<u-input type="select" v-model="model.area_text" :select-open="showSelect" placeholder="请选择地区" @click="showSelect = true"></u-input>
</u-form-item>
<u-form-item :labelStyle="labelStyle" label-position="left" label-width="150" label="详细地址:" prop="address">
<u-input border type="textarea" v-model="model.address" placeholder="如道路、门牌号、小区、楼栋号、单元室等" />
</u-form-item>
</view>
<!-- 设置默认 -->
<view class="default-box u-flex u-row-between">
<text class="title">设为默认地址</text>
<u-switch v-model="model.is_default" activeColor="#4C7AF3" size="40"></u-switch>
</view>
<!-- 功能按钮 -->
<view class="foot_box u-p-30 u-m-t-50 u-flex u-row-around">
<button v-show="addressId" class=" u-m-20 u-reset-button delete-btn u-flex-1" @tap="deleteAddress">删除收货地址</button>
<button class=" u-m-20 u-reset-button save-btn u-flex-1" @tap="submit">保存收货地址</button>
</view>
</u-form>
<!-- 省市区选择器 -->
<u-select mode="mutil-column-auto" safe-area-inset-bottom :list="addressAreaList" v-model="showSelect" @confirm="regionConfirm"></u-select>
<!-- 权限 -->
<yk-authpup ref="authpup" type="top" @changeAuth="handleChangeAuth" :permissionID="permissionID"></yk-authpup>
</view>
</template>
<script>
import { MAP_KEY } from '@/env.js';
import Auth from '@/shopro/permission/index.js';
import ykAuthpup from '@/components/yk-authpup/yk-authpup.vue';
export default {
components: {
ykAuthpup
},
data() {
return {
platform: this.$platform.get(),
permissionID: '',
showSelect: false, //省市区
addressAreaList: [],
addressId: 0, //收货地址ID
labelStyle: {
'font-size': '28rpx',
'font-weight': '600',
color: '#595959'
},
model: {
id: 0,
consignee: '',
phone: '',
area_text: '',
address: '',
is_default: false,
latitude: '',
longitude: ''
},
rules: {
phone: [
{
required: true,
message: '请输入收货人手机号',
trigger: ['change', 'blur']
},
{
validator: (rule, value, callback) => {
return this.$u.test.mobile(value);
},
message: '手机号码不正确',
trigger: ['change', 'blur']
}
],
consignee: [
{
required: true,
message: '请填写收货人姓名',
trigger: ['change', 'blur']
}
],
area_text: [
{
required: true,
message: '请选择地区',
trigger: ['change', 'blur']
}
],
address: [
{
required: true,
message: '请输入详细地址',
trigger: ['change', 'blur']
}
]
},
errorType: ['message'],
chooseAddress: '点击选择地理位置' //定位地址
};
},
computed: {},
onReady() {
this.$refs.uForm.setRules(this.rules);
},
onLoad() {
this.getArea();
this.addressId = this.$Route.query.id ? this.$Route.query.id : 0;
uni.setNavigationBarTitle({
title: this.addressId ? '编辑收货地址' : '添加收货地址'
});
this.addressId && this.getAddressInfo();
// 微信导入
this.$Route.query.addressData && this.wxAddressInit();
},
methods: {
// 打开权限
handleOpenAuth(permissionID) {
this.permissionID = permissionID;
setTimeout(() => {
this.$refs['authpup'].open();
}, 500)
},
// 同意授权后回调
async handleChangeAuth() {
let authState = await new Auth('userLocation').check();
authState &&
uni.chooseLocation({
success: res => {
this.model.latitude = res.latitude;
this.model.longitude = res.longitude;
this.getLocationInfo();
},
fail: err => {
console.log(err);
}
});
},
// 获取省市区
getArea() {
this.$http('address.area').then(res => {
if (res.code === 1) {
let { provinceData, cityData, areaData } = res.data;
provinceData.forEach((item, index) => {
this.addressAreaList.push({ ...item, children: [] });
this.addressAreaList[index].children.push(...cityData[index]);
this.addressAreaList[index].children.forEach((item1, index1) => {
item1['children'] = [];
item1.children.push(...areaData[index][index1]);
});
});
}
});
},
// 微信导入数据格式
wxAddressInit() {
let wxAddress = this.$Route.query.addressData; //微信导入
this.model.id = 0;
this.model.consignee = wxAddress.userName;
this.model.phone = wxAddress.telNumber;
// #ifdef MP-WEIXIN
this.model.area_text = `${wxAddress.provinceName}-${wxAddress.cityName}-${wxAddress.countyName}`;
// #endif
// #ifdef H5
this.model.area_text = `${wxAddress.provinceName}-${wxAddress.cityName}-${wxAddress.countryName}`;
// #endif
this.model.address = wxAddress.detailInfo.replace(/%20/g, '');
this.model.is_default = false;
},
// 确认省市区
regionConfirm(e) {
this.model.area_text = `${e[0].label}-${e[1].label}-${e[2].label}`;
},
// 获取定位
async getLocation() {
let authState = await new Auth('userLocation').check();
authState &&
uni.chooseLocation({
success: res => {
this.model.latitude = res.latitude;
this.model.longitude = res.longitude;
this.getLocationInfo();
},
fail: err => {
console.log(err);
}
});
},
//逆坐标解析
async getLocationInfo() {
this.chooseAddress = '定位中...';
const [error, res] = await uni.request({
url: `https://restapi.amap.com/v3/geocode/regeo?location=${this.model.longitude},${this.model.latitude}&key=${MAP_KEY}`
});
if (res.data.status === '1') {
const addressComponent = res.data.regeocode.addressComponent;
this.chooseAddress = res.data.regeocode.formatted_address;
this.model.area_text = `${addressComponent.province}-${addressComponent.city.length ? addressComponent.city : addressComponent.province}-${
addressComponent.district
}`;
this.model.address = res.data.regeocode.formatted_address.replace(`${addressComponent.province}${addressComponent.city}${addressComponent.district}`, '');
} else {
console.log('%c逆地址解析失败,请检查是否在env中配置地图key', 'color:green;background:yellow');
}
},
// 提交
submit() {
this.$refs.uForm.validate(valid => {
valid ? this.editAddress() : console.log('验证失败');
});
},
// 编辑添加地址
editAddress() {
let that = this;
that.$http(
'address.edit',
{
...that.model,
id: that.addressId
},
'保存中...'
).then(res => {
if (res.code === 1) {
that.$Router.back();
}
});
},
// 地址信息
getAddressInfo() {
const that = this;
this.$http('address.info', {
id: that.$Route.query.id
}).then(res => {
if (res.code === 1) {
let addressData = res.data;
that.addressId = addressData.id;
that.model.area_text = `${addressData.province_name}-${addressData.city_name}-${addressData.area_name}`;
that.model.is_default = addressData.is_default === '1' ? true : false;
that.model.address = addressData.address;
that.model.phone = addressData.phone;
that.model.consignee = addressData.consignee;
}
});
},
// 删除收货地址
deleteAddress() {
const that = this;
that.$http(
'address.del',
{
id: that.addressId
},
'删除中...'
).then(res => {
if (res.code === 1) {
that.$Router.back();
}
});
}
}
};
</script>
<style lang="scss">
// 点击定位
.location-item {
font-size: 28rpx;
font-weight: 500;
background-color: #fff;
color: rgba(167, 111, 13, 1);
}
// 表单
.address-box {
background-color: #fff;
padding: 0 30rpx;
}
.address-item {
height: 96rpx;
background: #fff;
border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
padding: 0 25rpx;
.item-title {
color: #333;
font-size: 28rpx;
white-space: nowrap;
}
.inp {
color: #333;
font-size: 28rpx;
}
}
.area-box {
min-height: 120rpx;
padding-bottom: 60rpx;
background: #fff;
padding: 30rpx 25rpx;
.item-title {
font-size: 28rpx;
line-height: 28rpx;
vertical-align: middle;
white-space: nowrap;
}
.area-inp {
color: #333;
font-size: 28rpx;
vertical-align: middle;
margin-top: 8rpx;
width: 550rpx;
}
}
.default-box {
height: 100rpx;
padding: 0 25rpx;
background: #fff;
margin-top: 20rpx;
.title {
font-size: 28rpx;
}
.switch {
transform: scale(0.8);
}
}
// 底部按钮
.foot_box {
.delete-btn {
line-height: 70rpx;
background: linear-gradient(93deg, rgba(208, 19, 37, 1), rgba(237, 60, 48, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(#ed3c30, 0.22);
font-size: 28rpx;
font-weight: 500;
color: rgba(255, 255, 255, 1);
border-radius: 35rpx;
padding: 0;
margin-right: 20rpx;
}
.save-btn {
line-height: 70rpx;
background: linear-gradient(90deg, #4C7AF3, #4C7AF3);
// border: 1rpx solid rgba(238, 238, 238, 1);
border-radius: 40rpx;
color: rgba(#fff, 0.9);
}
}
</style>

查看文件

@@ -0,0 +1,166 @@
<!-- 地址列表 -->
<template>
<view class="address-wrap">
<view class="address-list" v-for="address in addressList" :key="address.id" @tap="useAddress(address)">
<view class="top u-flex">
<text class="name">{{ address.consignee }}</text>
<text class="phone">{{ address.phone }}</text>
<text class="tag" v-show="address.is_default === '1'">默认</text>
</view>
<view class="detail">{{ address.province_name }}{{ address.city_name }}{{ address.area_name }}{{ address.address }}</view>
<button class="u-reset-button set-btn" @tap.stop="jump('/pages/user/address/edit', { id: address.id })">编辑</button>
</view>
<view class="foot_box-wrap safe-area-inset-bottom">
<view class="foot_box u-flex u-row-between safe-area-inset-bottom">
<!-- 微信小程序和微信H5 -->
<!-- <button
class="u-reset-button sync-wxaddress u-m-20 u-flex u-row-center u-col-center"
@tap="getWXaddress"
v-show="platform == 'wxMiniProgram' || platform == 'wxOfficialAccount'"
>
<text class="u-iconfont uicon-weixin-fill u-p-r-10" style="color:#09bb07;font-size: 40rpx;"></text>
导入微信地址
</button> -->
<button class="u-reset-button add-btn u-m-20" @tap="jump('/pages/user/address/edit')">添加新的收货地址</button>
</view>
</view>
</view>
</template>
<script>
import Auth from '@/shopro/permission/index.js';
export default {
components: {},
data() {
return {
addressList: [],
platform: this.$platform.get()
};
},
computed: {},
onLoad() {},
onShow() {
this.getAddressList();
},
methods: {
// 选中
useAddress(addressData) {
uni.$emit('SELECT_ADDRESS', { addressData: JSON.stringify(addressData) });
uni.navigateBack()
},
// 路由跳转
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
},
// 微信导入
getWXaddress() {
let authState = new Auth('address').check();
// #ifdef MP
authState &&
uni.chooseAddress({
success: res => {
this.jump('/pages/user/address/edit', { addressData: res });
},
fail: err => {
console.log('%cuni.chooseAddress,调用失败', 'color:green;background:yellow');
}
});
// #endif
// #ifdef H5
this.$wxsdk.openAddress(res => {
this.jump('/pages/user/address/edit', { addressData: res });
});
// #endif
},
getAddressList() {
this.$http('address.list').then(res => {
if (res.code === 1) {
this.addressList = res.data;
!this.addressList.length && uni.$emit('SELECT_ADDRESS', { addressData: null });
}
});
}
}
};
</script>
<style lang="scss">
.address-list {
padding: 40rpx;
position: relative;
background: #fff;
margin-bottom: 20rpx;
.name {
font-size: 30rpx;
font-weight: 600;
}
.phone {
font-size: 30rpx;
margin: 0 20rpx;
}
.tag {
background: rgba(76, 122, 243, 0.2);
border-radius: 6rpx;
padding: 0 16rpx;
line-height: 38rpx;
color: #4C7AF3;
font-size: 22rpx;
}
.detail {
margin-top: 25rpx;
width: 543rpx;
font-size: 26rpx;
font-weight: 400;
color: rgba(153, 153, 153, 1);
line-height: 40rpx;
}
.set-btn {
background: none;
position: absolute;
font-size: 26rpx;
color: #4C7AF3;
top: 40rpx;
right: 40rpx;
}
}
// 底部按钮
.foot_box-wrap {
height: 140rpx;
width: 100%;
}
.foot_box {
padding: 10rpx 20rpx;
position: fixed;
bottom: 0;
left: 0;
width: 100%;
background-color: #fff;
border-top: 1rpx solid rgba(#ccc, 0.2);
.sync-wxaddress {
flex: 1;
line-height: 80rpx;
background: rgba(255, 255, 255, 1);
border-radius: 40rpx;
box-shadow: 0 0 1rpx 6rpx rgba(#ccc, 0.2);
}
.add-btn {
line-height: 80rpx;
flex: 1;
background: linear-gradient(90deg, #4C7AF3, #4C7AF3);
border-radius: 40rpx;
color: rgba(#fff, 0.9);
}
}
</style>

查看文件

@@ -0,0 +1,190 @@
<!-- 收藏列表 -->
<template>
<view class="page_box">
<!-- 总收藏数 -->
<view class="head_box u-flex u-row-between" v-show="!isEmpty">
<view class="count-box">
共
<text class="all-num">{{ total }}</text>
件商品
</view>
<button class="set-btn u-reset-button" @tap="onSet">{{ isEdit ? '完成' : '编辑' }}</button>
</view>
<!-- 收藏列表 -->
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<u-checkbox-group @change="checkboxGroupChange" activeColor="#4C7AF3">
<view class="collect-list u-flex" v-for="f in favoriteList" :key="f.id">
<u-checkbox v-show="isEdit" :name="f.goods_id" shape="circle" v-model="f.checked"></u-checkbox>
<shopro-mini-card
:image="f.goods.image"
:title="f.goods.title"
:price="f.goods.price"
:originPrice="f.goods.original_price"
:subtitle="f.goods.subtitle"
@click="$Router.push({ path: '/pages/goods/detail', query: { id: f.goods_id } })"
></shopro-mini-card>
</view>
</u-checkbox-group>
<!-- 缺省页 -->
<shopro-empty
v-if="isEmpty"
:image="$IMG_URL + '/imgs/empty/empty_goods.png'"
tipText="暂无收藏"
btnText="去首页逛逛"
@click="$Router.pushTab('/pages/index/index')"
></shopro-empty>
<!-- 更多 -->
<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
</scroll-view>
</view>
<view class="foot_box ">
<view class="tools-box u-flex u-row-between u-flex-1" v-show="isEdit && !isEmpty">
<u-checkbox shape="circle" activeColor="#4C7AF3" @change="onAllSel" v-model="isAllSel"><text>全选</text></u-checkbox>
<button class="u-reset-button close-btn" @tap="cancelFavorite">取消收藏</button>
</view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
isEmpty: false,
isEdit: false,
isAllSel: false, //是否全选
selList: [],
favoriteList: [],
total: 0,
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {},
onLoad() {
this.getFavoriteList();
},
methods: {
// 单选
checkboxGroupChange(e) {
this.selList = e;
this.isAllSel = this.favoriteList.every(item => item.checked);
},
// 编辑
onSet() {
this.isEdit = !this.isEdit;
},
// 全选
onAllSel(e) {
this.isAllSel = e.value;
this.selList = [];
this.favoriteList.forEach(item => {
e.value && this.selList.push(item.goods_id);
this.$set(item, 'checked', e.value);
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getFavoriteList();
}
},
// 收藏列表
getFavoriteList() {
let that = this;
let list = [];
that.loadStatus = 'loading';
that.$http('user.favoriteList', {
pre_page: 10,
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.total = res.data.total;
list = res.data.data;
list.map(item => {
that.$set(item, 'checked', false);
});
that.favoriteList = [...that.favoriteList, ...list];
that.isEmpty = !that.favoriteList.length;
that.lastPage = res.data.last_page;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
},
// 取消收藏
cancelFavorite() {
let that = this;
let { favoriteList, selList } = this;
favoriteList = JSON.parse(JSON.stringify(favoriteList));
that.$http('goods.favorite', {
goods_ids: selList
}).then(res => {
if (res.code === 1) {
if (that.isAllSel) {
that.favoriteList = [];
that.isEmpty = true;
} else {
that.favoriteList = favoriteList.filter(f => !selList.includes(f.goods_id));
that.total = that.favoriteList.length;
}
}
});
}
}
};
</script>
<style lang="scss">
.head_box {
height: 70rpx;
padding: 0 30rpx;
.count-box {
font-size: 26rpx;
color: #999;
.all-num {
color: #4C7AF3;
}
}
.set-btn {
background: none;
font-size: 26rpx;
color: #4C7AF3;
padding: 20rpx;
}
}
.collect-list {
padding: 30rpx 20rpx;
background: #fff;
width: 750rpx;
margin-bottom: 20rpx;
}
.tools-box {
height: 100rpx;
width: 750rpx;
padding: 0 20rpx;
background: #fff;
.close-btn {
width: 200rpx;
line-height: 70rpx;
background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
border-radius: 35rpx;
padding: 0;
color: rgba(#fff, 0.9);
}
}
</style>

538
uniapp/pages/user/info.vue 普通文件
查看文件

@@ -0,0 +1,538 @@
<!-- 个人信息 -->
<template>
<view class="container">
<view class="u-flex u-row-between u-p-x-30 info-head u-p-y-20">
<view class="info-title">基本信息</view>
<button class="u-reset-button save-btn" :class="{ 'dis-btn': editInfoDisabled }"
:disabled="editInfoDisabled" @tap="editUserInfo">保存</button>
</view>
<view v-if="platform != 'App'" class="user-list u-flex u-row-between">
<text class="list-name">头像</text>
<view class="u-flex" @tap="onChooseImg">
<image class="avatar" :src="userData.avatar" mode=""></image>
<text class="u-iconfont uicon-arrow-right u-m-l-20" style="color:#999;"></text>
</view>
</view>
<view v-else class="user-list u-flex u-row-between">
<text class="list-name">头像</text>
<view class="u-flex" @tap="handleOpenAuth('WRITE_EXTERNAL_STORAGE')">
<image class="avatar" :src="userData.avatar" mode=""></image>
<text class="u-iconfont uicon-arrow-right u-m-l-20" style="color:#999;"></text>
</view>
</view>
<view class="user-list u-flex u-row-between">
<text class="list-name">昵称</text>
<view class="u-flex">
<input class="list-val" v-model="userData.nickname" @input="onChangeNickName" @blur="onChangeNickName"
@confirm="onChangeNickName" placeholder="请输入昵称~" maxlength="50"
placeholder-style="color:#c8c9cc;fontSize:28rpx" />
<text class="u-iconfont uicon-arrow-right u-m-l-20" style="color:#999;"></text>
</view>
</view>
<view class="user-list u-flex u-row-between u-m-b-10" @tap="showCalendar = true">
<text class="list-name">生日</text>
<view class="u-flex">
<text class="list-val">{{ userData.birthday || '请选择生日~' }}</text>
<text class="u-iconfont uicon-arrow-right u-m-l-20" style="color:#999;"></text>
</view>
</view>
<view class="user-list u-flex u-row-between" @tap="$Router.push('/pages/user/address/list')">
<text class="list-name">地址管理</text>
<view class="u-flex">
<text class="list-val"></text>
<text class="u-iconfont uicon-arrow-right u-m-l-20" style="color:#999;"></text>
</view>
</view>
<view class="user-list u-flex u-row-between" @tap="changePwd">
<text class="list-name">修改密码</text>
<view class="u-flex">
<text class="list-val"></text>
<text class="u-iconfont uicon-arrow-right u-m-l-20" style="color:#999;"></text>
</view>
</view>
<view class="user-list u-flex u-row-between" @tap="bindMobile">
<text class="list-name">手机号</text>
<view class="u-flex">
<text class="list-val">{{ userInfo.mobile || '暂未绑定手机号' }}</text>
<text v-if="userInfo.id && !userInfo.verification.mobile" class="u-iconfont uicon-arrow-right u-m-l-20"
style="color:#999;"></text>
<text v-else class="u-iconfont uicon-checkmark-circle-fill u-m-l-20" style="color:#09BB07;"></text>
</view>
</view>
<!-- 第三方账号 -->
<view class="other-account" v-if="platform !== 'H5'">
<view class="head-title u-p-x-30">第三方账号绑定</view>
<!-- #ifdef MP-WEIXIN -->
<!-- 微信小程序 -->
<view v-if="platform === 'wxMiniProgram'" class="account-list u-flex u-row-between">
<view class=" u-flex u-col-center">
<image class="list-img" :src="$IMG_URL + '/imgs/user/bind_wxmp.png'" mode=""></image>
<text class="list-name">微信小程序</text>
</view>
<view class="u-flex u-col-center">
<view class="info u-flex u-col-center">
<open-data class="avatar u-m-r-20" type="userAvatarUrl"></open-data>
<open-data class="name" type="userNickName"></open-data>
</view>
<view class="bind-box u-m-l-20">
<!-- <button class="u-reset-button bind-btn"
v-if="userInfo.id && !userInfo.verification.wxMiniProgram"
@tap="bindThirdOauth('wxMiniProgram', 'Wechat')">
绑定
</button> -->
<button class="u-reset-button bind-btn"
v-if="userInfo.id && !userInfo.verification.wxMiniProgram" open-type="getPhoneNumber"
@getphonenumber="bindWechat">
绑定
</button>
<button class="u-reset-button relieve-btn" v-else
@tap="unbindThirdOauth('wxMiniProgram', 'Wechat')">解绑</button>
</view>
</view>
</view>
<!-- #endif -->
<view class="other-account" @click="handleLogOffUser">
<view class="head-title u-p-x-30">账号注销</view>
<view class="account-list u-flex u-row-between">
<view class=" u-flex u-col-center">
<image class="list-img" :src="$IMG_URL + '/assets/img/close-user.png'" mode=""></image>
<text class="list-name">注销账号</text>
</view>
</view>
</view>
<!-- #ifdef H5 -->
<!-- 微信公众号 -->
<view v-if="platform === 'wxOfficialAccount'" class="account-list u-flex u-row-between">
<view class=" u-flex u-col-center">
<image class="list-img" :src="$IMG_URL + '/imgs/user/bind_wxh5.png'" mode=""></image>
<text class="list-name">微信公众号</text>
</view>
<view class="u-flex u-col-center">
<view class="info u-flex u-col-center" v-if="thirdOauthInfo">
<image class="avatar u-m-r-20" :src="thirdOauthInfo.headimgurl" mode=""></image>
<view class="name">{{ thirdOauthInfo.nickname }}</view>
</view>
<view class="bind-box u-m-l-20">
<button class="u-reset-button bind-btn"
v-if="userInfo.id && !userInfo.verification.wxOfficialAccount"
@tap="bindThirdOauth('wxOfficialAccount', 'Wechat')">
绑定
</button>
<button class="u-reset-button relieve-btn" v-else
@tap="unbindThirdOauth('wxOfficialAccount', 'Wechat')">解绑</button>
</view>
</view>
</view>
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<!-- App -->
<view v-if="platform === 'App'" class="account-list u-flex u-row-between">
<view class=" u-flex u-col-center">
<image class="list-img" :src="$IMG_URL + '/imgs/user/bind_wx.png'" mode=""></image>
<text class="list-name">微信</text>
</view>
<view class="u-flex u-col-center">
<view class="info u-flex u-col-center" v-if="thirdOauthInfo">
<image class="avatar u-m-r-20" :src="thirdOauthInfo.headimgurl" mode=""></image>
<view class="name">{{ thirdOauthInfo.nickname }}</view>
</view>
<view class="bind-box u-m-l-20">
<!-- <button class="u-reset-button bind-btn"
v-if="userInfo.id && !userInfo.verification.wxOpenPlatform"
@tap="bindThirdOauth('App', 'Wechat')">绑定</button> -->
<button class="u-reset-button bind-btn"
v-if="userInfo.id && !userInfo.verification.wxMiniProgram"
@tap="bindThirdOauth('App', 'Wechat')">绑定</button>
<button class="u-reset-button relieve-btn" v-else
@tap="unbindThirdOauth('App', 'Wechat')">解绑</button>
</view>
</view>
</view>
<!-- #endif -->
</view>
<view class="btn-box u-flex u-row-center u-col-center">
<button hover-class="hover-logout-btn" class="u-reset-button logout-btn"
@tap="showModal = true">退出登录</button>
</view>
<!-- 登录提示 -->
<shopro-auth-modal v-if="authType"></shopro-auth-modal>
<!-- 日历 -->
<u-picker @confirm="changeCalendar" mode="time" confirm-color="#4C7AF3" v-model="showCalendar"
:params="{ year: true, month: true, day: true, hour: false, minute: false, second: false }"></u-picker>
<!-- modal -->
<u-modal ref="uModal" v-model="showModal" :show-cancel-button="true" confirm-color="#F54141"
cancel-color="#666666" @confirm="confirmLogOut" :content="content"></u-modal>
<!-- 权限 -->
<yk-authpup ref="authpup" type="top" @changeAuth="handleChangeAuth" :permissionID="permissionID"></yk-authpup>
</view>
</template>
<script>
import {
mapMutations,
mapActions,
mapState,
mapGetters
} from 'vuex';
import Auth from '@/shopro/permission/index.js';
import wechat from '@/shopro/wechat/wechat';
import ykAuthpup from '@/components/yk-authpup/yk-authpup.vue';
export default {
components: {
ykAuthpup
},
data() {
return {
permissionID: '',
content: '确定退出登录?',
platform: this.$platform.get(),
userData: {},
showCalendar: false,
showModal: false,
editInfoDisabled: true,
thirdOauthInfo: null //第三方信息
};
},
computed: {
...mapGetters(['userInfo', 'authType'])
},
onLoad() {
this.userData = JSON.parse(JSON.stringify(this.userInfo));
this.getThirdOauthInfo();
},
methods: {
...mapActions(['getUserInfo', 'showAuthModal', 'logout']),
// 打开权限
handleOpenAuth(permissionID) {
this.permissionID = permissionID;
setTimeout(() => {
this.$refs['authpup'].open();
}, 500)
},
// 同意授权后回调
async handleChangeAuth() {
const chooseImageRes = await this.chooseImage(1);
const uploadImageRes = await this.uploadImage(chooseImageRes[0]);
this.userData.avatar = uploadImageRes.fullurl;
this.userData.fileUrl = uploadImageRes.url;
this.editInfoDisabled = this.userData.avatar == this.userInfo.avatar;
},
handleLogOffUser() {
this.content = '您确定要注销账号吗?';
this.showModal = true;
},
// 选择日期
changeCalendar(e) {
this.userData.birthday = `${e.year}-${e.month}-${e.day}`;
this.editInfoDisabled = this.userData.birthday == this.userInfo.birthday;
},
// 修改密码
changePwd() {
this.showAuthModal('changePwd');
},
// 修改昵称
onChangeNickName() {
this.editInfoDisabled = this.userData.nickname == this.userInfo.nickname;
},
// 修改手机号
bindMobile() {
!this.userInfo.verification.mobile && this.showAuthModal('bindMobile');
},
// 更换头像
async onChooseImg() {
let authState = 0;
authState += await new Auth('writePhotosAlbum').check();
if (authState < 1) return;
authState += await new Auth('camera').check();
if (authState < 2) return;
const chooseImageRes = await this.chooseImage(1);
const uploadImageRes = await this.uploadImage(chooseImageRes[0]);
this.userData.avatar = uploadImageRes.fullurl;
this.userData.fileUrl = uploadImageRes.url;
this.editInfoDisabled = this.userData.avatar == this.userInfo.avatar;
},
// 第三方绑定信息
getThirdOauthInfo() {
let that = this;
that.$http('user.thirdOauthInfo').then(res => {
if (res.code === 1) {
that.thirdOauthInfo = res.data;
}
});
},
// 解绑
unbindThirdOauth(platform, provider) {
let that = this;
that.$http('user.unbindThirdOauth', {
platform,
provider
}).then(res => {
if (res.code === 1) {
uni.showToast({
title: res.msg
});
that.thirdOauthInfo = null;
that.getUserInfo();
}
});
},
// 绑定信息
bindWechat(e) {
uni.login({
success: res => {
if (e.detail.errMsg === "getPhoneNumber:ok") {
this.$http("user.wxMiniProgramOauth", {
event: 'bind',
login_code: res.code,
spm: uni.getStorageSync('spm'),
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
}).then(res => {
if (res.code === 1) {
this.getUserInfo(res.data.token);
res.data.chatToken && uni.setStorageSync('chatToken', res.data
.chatToken);
} else {
uni.removeStorageSync("session_key");
that.getWxMiniProgramSessionKey(false);
}
});
}
}
});
},
// 绑定
async bindThirdOauth(platform, provider) {
let that = this;
switch (platform) {
case 'wxOfficialAccount':
wechat.bind();
break;
case 'wxMiniProgram':
await wechat.bind();
that.getUserInfo();
break;
case 'App':
if (provider === 'Wechat') {
await wechat.bind();
}
that.getUserInfo();
that.getThirdOauthInfo();
break;
}
},
// 退出登录
confirmLogOut() {
this.logout();
this.$Router.back();
},
// 修改信息
editUserInfo() {
let that = this;
if (!that.userData.nickname) {
this.$u.toast('昵称不能为空');
return false;
}
that.$http(
'user.profile', {
nickname: that.userData.nickname,
birthday: that.userData.birthday,
avatar: that.userData.fileUrl
},
'保存中...'
).then(res => {
if (res.code === 1) {
that.getUserInfo();
that.editInfoDisabled = true;
that.$u.toast('保存成功');
}
});
},
// 图片处理-选择图片
async chooseImage(count = 1) {
return new Promise((resolve, reject) => {
uni.chooseImage({
count: count, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: res => {
resolve(res.tempFilePaths);
}
});
}).catch(e => {
console.log(e);
});
},
// 图片处理-上传图片
async uploadImage(url) {
const that = this;
return new Promise((resolve, reject) => {
that.$u.toast('上传中...');
uni.uploadFile({
url: that.$API_URL + 'index/upload',
filePath: url,
name: 'file',
success: res => {
res = JSON.parse(res.data);
if (res.code === 1) {
that.$u.toast('上传成功');
resolve(res.data);
} else {
that.$u.toast('上传失败');
}
},
complete: e => {
uni.hideLoading();
}
});
}).catch(e => {
console.log(e);
});
}
}
};
</script>
<style lang="scss" scoped>
// 基本信息
.info-head {
.info-title {
line-height: 60rpx;
font-size: 28rpx;
font-weight: 600;
color: #333333;
}
.save-btn {
color: #fff;
background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
width: 100rpx;
border-radius: 30rpx;
height: 60rpx;
line-height: 60rpx;
font-size: 28rpx;
}
.dis-btn {
opacity: 0.5;
}
}
// 三方
.other-account {
.head-title {
line-height: 82rpx;
font-size: 28rpx;
font-weight: 600;
color: #333333;
}
.list-img {
width: 40rpx;
height: 40rpx;
margin-right: 10rpx;
}
.account-list {
background-color: #fff;
height: 100rpx;
padding: 0 20rpx;
.info {
.avatar {
width: 38rpx;
height: 38rpx;
border-radius: 50%;
overflow: hidden;
}
.name {
font-size: 28rpx;
font-weight: 400;
color: #999999;
}
}
.bind-box {
.bind-btn {
padding: 0 20rpx;
line-height: 60rpx;
background: #f5f6f8;
border-radius: 20rpx;
color: #999;
}
.relieve-btn {
border-radius: 20rpx;
padding: 0 20rpx;
line-height: 60rpx;
background: rgba(#ff0000, 0.05);
color: #ff0000;
}
}
}
}
// 个人信息项
.user-list {
background: #fff;
height: 100rpx;
border-bottom: 1rpx solid #f6f6f6;
padding: 0 20rpx;
.list-name {
font-size: 28rpx;
}
.avatar {
width: 67rpx;
height: 67rpx;
border-radius: 50%;
}
.list-val {
color: #999;
font-size: 28rpx;
text-align: right;
}
}
.btn-box {
margin-top: 200rpx;
.logout-btn {
width: 710rpx;
height: 80rpx;
line-height: 80rpx;
border: 1rpx solid #f54141;
border-radius: 40rpx;
font-size: 30rpx;
font-weight: 500;
color: #f54141;
}
.hover-logout-btn {
width: 710rpx;
height: 80rpx;
background: #f54141;
border: 1rpx solid #f54141;
border-radius: 40rpx;
font-size: 30rpx;
font-weight: 500;
color: #ffffff;
}
}
</style>

查看文件

@@ -0,0 +1,449 @@
<template>
<div>
<view :style="{width: width + 'px',height:height + 'px'}" v-if="markact" class="mark">
<text class="mark-text">直播启动中...</text>
</view>
<view>
<view @click="returns" class="arrow-box">
<text class="jiesu">结束直播</text>
</view>
<live-pusher :beauty="beauty" :style="{width: width + 'px',height:height + 'px'}" id="livePusher" :url="url"
mode="FHD"></live-pusher>
<!-- 这是聊天室 -->
<!-- <view class="chat">
<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y" @scrolltoupper="upper"
@scrolltolower="lower" @scroll="scroll">
<view class="chat-list" v-for="(it,i) in chatList" :key='i'>
<text class="chat-username">{{it.name}}:</text>
<text class="chat-usertext">{{it.text}}</text>
</view>
</scroll-view>
</view> -->
<!-- 这是功能按钮 -->
<view :style="{width: width + 'px'}" class="but">
<!-- <view @click="openMark(0)" class="meiyanbut">
<image class="but-img" src="../../static/zhiboshop.png"></image>
<text class="but-text">宝贝</text>
</view> -->
<view @click="openmeiyan" class="meiyanbut">
<image class="but-img" src="../../static/meiyan.png"></image>
<text v-if="beauty == 0" class="but-text">开启美颜</text>
<text v-if="beauty == 9" class="but-text">关闭美颜</text>
</view>
<view @click="switchCamera" class="meiyanbut">
<image class="but-img" src="../../static/qiehuan.png"></image>
<text class="but-text">切换摄像头</text>
</view>
</view>
<uni-popup ref="popup" type="bottom">
<!-- 这是商品弹窗 -->
<view class="shop-list-box" :style="{width: width + 'px'}" v-if="type == 0">
<text :style="{width: width + 'px'}" class="mark-title">直播商品</text>
<text @click="add()" class="add-shop">添加商品</text>
<scroll-view :style="{width: width + 'px'}" :scroll-top="scrollTop" scroll-y="true"
class="scroll-Ys" @scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
<view class="shop-list-list" v-for="(it,i) in shopArr" :key='i'>
<view>
<image class="shop-list-img" :src="it.img"></image>
</view>
<view>
<text class="shop-list-title">{{it.title}}</text>
<text class="shop-list-num">剩余{{it.num}}件</text>
<text class="shop-list-price">¥{{it.price}}</text>
</view>
<view class="shop-list-but-box">
<text class="shop-list-but">移除</text>
</view>
</view>
</scroll-view>
</view>
</uni-popup>
</view>
<!-- <u-modal :show="show" content='是否结束直播'></u-modal> -->
</div>
</template>
<script>
import uniPopup from "@/components/uni-popup/uni-popup.vue"
export default {
components: {
uniPopup
},
data() {
return {
show: false,
type: "",
width: '',
height: '',
url: '', //这是推流地址
enableCamera: false,
context: null,
markact: true,
arr: [],
shopArr: [{
img: '../../static/logo.png',
title: '测试商品',
price: '111',
num: '20',
},
{
img: '../../static/logo.png',
title: '测试商品',
price: '111',
num: '20',
},
{
img: '../../static/logo.png',
title: '测试商品',
price: '111',
num: '20',
},
{
img: '../../static/logo.png',
title: '测试商品',
price: '111',
num: '20',
},
{
img: '../../static/logo.png',
title: '测试商品',
price: '111',
num: '20',
}
],
chatList: [{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
},
{
name: '用户01',
text: '哈哈哈哈哈'
}
],
beauty: 0
};
},
onLoad() {
let info = uni.getSystemInfoSync()
this.width = info.windowWidth;
this.height = info.windowHeight;
uni.$http('common.getLiveAddr').then(res => {
this.url = res.data.liveUrl
})
},
onReady() {
this.context = uni.createLivePusherContext('livePusher', this);
setTimeout(() => {
this.startLive();
}, 1000)
},
methods: {
add() {
console.log('s')
},
// 0是宝贝弹窗,1是订单弹窗,2是工具弹窗,3是设置弹窗
openMark(type) {
this.type == type
this.$refs.popup.open()
},
openmeiyan() {
// this.$refs.popup.open()
if (this.beauty == 0) {
this.beauty = 9
} else {
this.beauty = 0
}
},
returns() {
let that = this
uni.showModal({
content: "是否结束直播",
cancelText: "取消",
confirmText: "结束",
success: (res) => {
if (res.confirm) {
that.stopLive()
}
}
})
// this.stopLive();
// uni.navigateBack({
// delta: 1
// })
},
EnableCamera() {
this.enableCamera = true;
},
startLive() {
let self = this;
this.context.start({
success: a => {
self.markact = false;
console.log('livePusher.start:' + JSON.stringify(a));
}
});
},
stopLive() {
uni.$http('common.endLive').then(res => {
uni.navigateBack()
})
// this.context.stop({
// success: a => {
// console.log(JSON.stringify(a));
// }
// });
},
switchCamera() {
this.context.switchCamera({
success: (a) => {
console.log("livePusher.switchCamera:" + JSON.stringify(a));
}
});
}
}
}
</script>
<style>
.add-shop {
font-size: 16px;
color: #333333;
position: absolute;
top: 20px;
left: 20px;
z-index: 10;
}
.shop-list-but-box {
position: absolute;
bottom: 10px;
right: 20px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: row;
}
.shop-list-but {
color: white;
border-radius: 2px;
font-size: 16px;
background-color: #D4237A;
padding: 10px 20px 10px 20px;
}
.mark-title {
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
font-size: 20px;
}
.shop-list-img {
margin-right: 10px;
width: 100px;
height: 100px;
}
.shop-list-title {
font-size: 20px;
color: #333333;
}
.shop-list-num {
font-size: 16px;
color: #C0C0C0;
padding-top: 10px;
}
.shop-list-price {
font-size: 16px;
color: #D4237A;
padding-top: 10px;
}
.scroll-Ys {
background-color: white;
height: 300px;
width: 100%;
}
.shop-list-box {
position: relative;
background-color: white;
width: 100%;
height: 380px;
}
.shop-list-list {
position: relative;
padding-top: 5px;
padding-bottom: 5px;
display: flex;
align-items: flex-start;
flex-direction: row;
}
.chat-username {
font-size: 18px;
color: white;
}
.chat-usertext {
font-size: 16px;
color: white;
}
.chat-list {
margin-top: 5px;
display: flex;
align-items: center;
justify-content: flex-start;
flex-direction: row;
background-color: rgba(0, 0, 0, .5);
padding: 5px 10px 5px 10px;
border-radius: 3px;
}
.scroll-Y {
height: 150px;
width: 250px;
}
.chat {
position: fixed;
z-index: 10;
bottom: 80px;
}
.but-img {
width: 20px;
height: 20px;
}
.meiyanbut {
padding: 10px 20px 10px 20px;
margin-left: 20px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.but-text {
padding-top: 3px;
font-size: 13px;
color: white;
}
.id {
font-size: 14px;
color: white;
}
.text-box {
font-size: 12px;
color: white;
}
.user-img {
margin-right: 5px;
width: 30px;
height: 30px;
border-radius: 50%;
}
.mark-text {
color: white;
font-size: 20px;
}
.mark {
position: fixed;
top: 0px;
background-color: #000000;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.but {
background-color: rgba(0, 0, 0, .4);
position: fixed;
bottom: 0px;
display: flex;
align-items: center;
flex-direction: row;
padding-bottom: 20px;
}
.tui {
width: 200px;
height: 200px;
}
.arrow-box {
position: fixed;
top: 60px;
left: 20px;
z-index: 10;
border-radius: 20px;
background-color: rgba(0, 0, 0, .4);
}
.arrow-boxs {
padding: 10px 20px 10px 20px;
display: flex;
align-items: center;
flex-direction: row;
position: fixed;
top: 60px;
left: 140px;
z-index: 10;
border-radius: 30px;
background-color: rgba(0, 0, 0, .4);
}
.jiesu {
padding: 10px 20px 10px 20px;
color: white;
font-size: 16px;
}
.arrow {
width: 15px;
height: 15px;
}
</style>

441
uniapp/pages/user/live.nvue 普通文件
查看文件

@@ -0,0 +1,441 @@
<template>
<view>
<view :style="{width: width + 'px',height:height + 'px'}" v-if="showMarkact" class="mark">
<text class="mark-text">直播准备中...</text>
</view>
<live-pusher v-else :beauty="beauty" :whiteness="whiteness" :style="{width: width + 'px',height:height + 'px'}"
id="livePusher" :url="url" mode="FHD"></live-pusher>
<!-- 这是功能按钮 -->
<view :style="{width: width + 'px'}" class="but">
<view @click="handleBackUser" class="meiyanbut">
<image class="but-img" src="../../static/live-back.png"></image>
<text class="but-text">返回</text>
</view>
<view @click="handelBeauty" class="meiyanbut">
<template v-if="beauty == 0">
<image class="but-img" src="../../static/live-love.png"></image>
<text class="but-text">美颜</text>
</template>
<template v-else>
<image class="but-img" src="../../static/live-love-active.png"></image>
<text class="but-text live-text">美颜</text>
</template>
</view>
<view @click="handelOpenLive" class="meiyanbut">
<template v-if="!liveStatus">
<image class="but-img" src="../../static/live-open.png"></image>
<text class="but-text">开播</text>
</template>
<template v-else>
<image class="but-img" src="../../static/live-open-active.png"></image>
<text class="but-text live-text">开播</text>
</template>
</view>
<view @click="handelWhiteness" class="meiyanbut">
<template v-if="whiteness == 0">
<image class="but-img" src="../../static/live-white.png"></image>
<text class="but-text">美白</text>
</template>
<template v-else>
<image class="but-img" src="../../static/live-white-active.png"></image>
<text class="but-text live-text">美白</text>
</template>
</view>
<view @click="handelSwitchCamera" class="meiyanbut">
<template v-if="!camera">
<image class="but-img" src="../../static/live-video.png"></image>
<text class="but-text">切换摄像头</text>
</template>
<template v-else>
<image class="but-img" src="../../static/live-video-active.png"></image>
<text class="but-text live-text">切换摄像头</text>
</template>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
show: false,
type: "",
width: '',
height: '',
url: '', // 这是推流地址
camera: false,
context: null,
showMarkact: true,
liveStatus: false,
beauty: 0,
whiteness: 0
};
},
// 页面加载
onLoad() {
// 获取手机信息
let info = uni.getSystemInfoSync();
this.width = info.windowWidth;
this.height = info.windowHeight;
},
// 页面完成
onReady() {
this.context = uni.createLivePusherContext('livePusher', this);
// setTimeout(() => {
// this.startLive();
// }, 1000)
},
// 页面卸载
onUnload() {
if (this.liveStatus) {
this.handelStopLive();
}
},
methods: {
// 开启关闭直播
handelOpenLive() {
if (!this.liveStatus) {
uni.showModal({
title: '温馨提示',
content: '您是否要开启直播?',
cancelText: '取消',
confirmText: '开启',
success: res => {
if (res.confirm) {
this.handleOpenLive();
}
}
});
} else {
uni.showModal({
title: '温馨提示',
content: '你是否要关闭直播?',
cancelText: '取消',
confirmText: '关闭',
success: res => {
if (res.confirm) {
this.handelStopLive();
}
}
});
}
},
// 返回个人中心
handleBackUser() {
if (this.liveStatus) {
uni.showModal({
title: '温馨提示',
content: '您当前正在直播中是否要返回?',
cancelText: '取消',
confirmText: '返回',
success: res => {
if (res.confirm) {
// this.handelStopLive();
uni.switchTab({
url: '/pages/index/user'
})
}
}
});
} else {
uni.switchTab({
url: '/pages/index/user'
})
}
},
// 开启直播
handleOpenLive() {
uni.showLoading({
title: '直播开启中...',
mask: true,
})
uni.$http('common.getLiveAddr').then(res => {
this.liveStatus = true;
this.showMarkact = false;
this.url = res.data.liveUrl;
this.startLive();
}).finally(() => {
uni.hideLoading();
});
},
// 关闭直播
handelStopLive() {
uni.showLoading({
title: '直播关闭中...',
mask: true,
})
uni.$http('common.endLive').then(res => {
this.liveStatus = false;
this.showMarkact = true;
this.url = '';
this.stopLive();
}).finally(() => {
uni.hideLoading();
});
},
// 美颜
handelBeauty() {
if (this.liveStatus) {
this.beauty = this.beauty == 0 ? 9 : 0
}
},
// 美白
handelWhiteness() {
if (this.liveStatus) {
this.whiteness = this.whiteness == 0 ? 9 : 0
}
},
// 开启推流
startLive() {
let self = this;
self.context.start({
success: res => {
console.log('livePusher.start:' + JSON.stringify(res));
}
});
},
// 停止推流
stopLive: function() {
this.context.stop({
success: res => {
console.log(JSON.stringify(res));
}
});
},
// 切换摄像头
handelSwitchCamera() {
let self = this;
if (self.liveStatus) {
self.context.switchCamera({
success: res => {
console.log(res);
self.camera = true;
console.log("livePusher.switchCamera:" + JSON.stringify(res));
}
});
}
}
}
}
</script>
<style>
.live-text {
color: #f4ea29 !important;
}
.add-shop {
font-size: 16px;
color: #333333;
position: absolute;
top: 20px;
left: 20px;
z-index: 10;
}
.shop-list-but-box {
position: absolute;
bottom: 10px;
right: 20px;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: row;
}
.shop-list-but {
color: white;
border-radius: 2px;
font-size: 16px;
background-color: #D4237A;
padding: 10px 20px 10px 20px;
}
.mark-title {
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
font-size: 20px;
}
.shop-list-img {
margin-right: 10px;
width: 100px;
height: 100px;
}
.shop-list-title {
font-size: 20px;
color: #333333;
}
.shop-list-num {
font-size: 16px;
color: #C0C0C0;
padding-top: 10px;
}
.shop-list-price {
font-size: 16px;
color: #D4237A;
padding-top: 10px;
}
.scroll-Ys {
background-color: white;
height: 300px;
width: 100%;
}
.shop-list-box {
position: relative;
background-color: white;
width: 100%;
height: 380px;
}
.shop-list-list {
position: relative;
padding-top: 5px;
padding-bottom: 5px;
display: flex;
align-items: flex-start;
flex-direction: row;
}
.chat-username {
font-size: 18px;
color: white;
}
.chat-usertext {
font-size: 16px;
color: white;
}
.chat-list {
margin-top: 5px;
display: flex;
align-items: center;
justify-content: flex-start;
flex-direction: row;
background-color: rgba(0, 0, 0, .5);
padding: 5px 10px 5px 10px;
border-radius: 3px;
}
.scroll-Y {
height: 150px;
width: 250px;
}
.chat {
position: fixed;
z-index: 10;
bottom: 80px;
}
.but-img {
width: 20px;
height: 20px;
}
.meiyanbut {
padding: 30rpx;
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.but-text {
padding-top: 3px;
font-size: 13px;
color: white;
}
.id {
font-size: 14px;
color: white;
}
.text-box {
font-size: 12px;
color: white;
}
.user-img {
margin-right: 5px;
width: 30px;
height: 30px;
border-radius: 50%;
}
.mark-text {
color: white;
font-size: 20px;
}
.mark {
position: fixed;
top: 0;
background-color: #000000;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.but {
background-color: rgba(0, 0, 0, .4);
position: fixed;
bottom: 0;
display: flex;
align-items: center;
flex-direction: row;
padding-bottom: 30rpx;
justify-content: center;
}
.tui {
width: 200px;
height: 200px;
}
.arrow-box {
position: fixed;
top: 60px;
left: 20px;
z-index: 10;
border-radius: 20px;
background-color: rgba(0, 0, 0, .4);
}
.arrow-boxs {
padding: 20rpx 20px 10px 20px;
display: flex;
align-items: center;
flex-direction: row;
position: fixed;
top: 60px;
left: 140px;
z-index: 10;
border-radius: 30px;
background-color: rgba(0, 0, 0, .4);
}
.jiesu {
padding: 10px 20px 10px 20px;
color: white;
font-size: 16px;
}
.arrow {
width: 15px;
height: 15px;
}
</style>

查看文件

@@ -0,0 +1,265 @@
<template>
<view class="page_box">
<view class="content_box">
<scroll-view scroll-y="true" enable-back-to-top @scrolltolower="loadMore" class="scroll-box">
<!-- 订单列表 -->
<view class="order-list" v-for="(order, orderIndex) in orderList" :key="order.id">
<view class="order-head u-flex u-row-between">
<text class="no">活动标题:{{ order.title }}</text>
<text class="state">
{{order.status_text}}
</text>
</view>
<view class="goods-order">
<view class="order-content">
<shopro-mini-card :title="order.goods_title" :image="$IMG_URL + order.image">
<template #cardBottom>
<view class="order-price-box u-flex ">
<text class="order-price font-OPPOSANS">¥{{ order.activity_price || 0 }}</text>
<button class="u-reset-button status-btn">{{order.status_text}}</button>
</view>
</template>
</shopro-mini-card>
</view>
</view>
<view class="order-bottom">
<!-- 按钮 -->
<view class="btn-box u-flex">
<button @tap.stop="jump('/pages/goods/detail', { id: order.goods_id })"
class="u-reset-button obtn2">查看活动</button>
</view>
</view>
</view>
<!-- 空白页 -->
<shopro-empty v-if="isEmpty" :image="$IMG_URL + '/imgs/empty/empty_groupon.png'"
tipText="暂无预约的抢购~"></shopro-empty>
<!-- 更多 -->
<u-loadmore v-show="orderList.length" height="80rpx" :status="loadStatus" icon-type="flower"
color="#ccc" />
</scroll-view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
isEmpty: false,
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
orderList: [],
};
},
onShow() {
this.orderList = [];
this.currentPage = 1;
this.lastPage = 1;
this.getOrderList();
},
methods: {
jump(path, parmas) {
this.$Router.push({
path: path,
query: parmas
});
},
// 订单列表
getOrderList() {
let that = this;
that.loadStatus = 'loading';
that.$http('rob.index', {
page: that.currentPage
}, '加载中...').then(res => {
if (res.code === 1) {
that.orderList = [...that.orderList, ...res.data.list];
that.isEmpty = !that.orderList.length;
that.lastPage = res.data.totalSize;
that.loadStatus = that.currentPage < res.data.totalSize ? 'loadmore' : 'nomore';
}
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getOrderList();
}
},
// 立即购买
onPay(id) {
uni.navigateTo({
url: `/pages/order/payment/method?orderId=${id}&orderType=goods`
});
},
}
};
</script>
<style lang="scss">
.order-nav {
background: #fff;
height: 80rpx;
.nav-item {
flex: 1;
.item-title {
font-size: 30rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
line-height: 76rpx;
}
.nav-line {
width: 100rpx;
height: 4rpx;
background: #fff;
}
.line-active {
background: rgba(230, 184, 115, 1);
}
}
}
.order-list {
background: #fff;
margin: 20rpx 0;
.order-bottom {
padding-bottom: 20rpx;
.btn-box {
justify-content: flex-end;
}
.all-msg {
font-size: 24rpx;
color: #999;
justify-content: flex-end;
margin-bottom: 10rpx;
padding: 0 30rpx;
.all-unit {
font-size: 20rpx;
}
.all-money {
font-size: 26rpx;
color: #333;
font-weight: 500;
&::before {
content: '¥';
font-size: 20rpx;
}
}
}
.obtn1 {
width: 160rpx;
line-height: 60rpx;
background: rgba(238, 238, 238, 1);
border-radius: 30rpx;
font-size: 26rpx;
font-weight: 400;
color: rgba(51, 51, 51, 1);
margin-right: 20rpx;
padding: 0;
}
.obtn2 {
width: 160rpx;
line-height: 60rpx;
background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
border-radius: 30rpx;
margin-right: 20rpx;
font-size: 26rpx;
font-weight: 400;
color: #fff;
padding: 0;
}
.obtn3 {
background: #ffeeee;
color: #e50808;
width: 160rpx;
line-height: 60rpx;
border-radius: 30rpx;
margin-right: 20rpx;
font-size: 26rpx;
font-weight: 400;
padding: 0;
}
}
.order-head {
padding: 0 25rpx;
height: 77rpx;
border-bottom: 1rpx solid #dfdfdf;
.no {
font-size: 26rpx;
color: #999;
}
.state {
font-size: 26rpx;
color: #4C7AF3;
}
}
.goods-order {
border-bottom: 1px solid rgba(223, 223, 223, 0.5);
padding: 20rpx 20rpx 0;
margin-bottom: 20rpx;
.order-content {
padding-bottom: 20rpx;
.order-sku {
font-size: 24rpx;
font-weight: 400;
color: rgba(153, 153, 153, 1);
width: 450rpx;
margin-bottom: 20rpx;
.order-num {
margin-right: 10rpx;
}
}
.order-price-box {
.status-btn {
height: 32rpx;
border: 1rpx solid rgba(207, 169, 114, 1);
border-radius: 15rpx;
font-size: 20rpx;
font-weight: 400;
color: rgba(168, 112, 13, 1);
padding: 0 10rpx;
margin-left: 20rpx;
background: rgba(233, 183, 102, 0.16);
}
.order-price {
font-size: 26rpx;
font-weight: 600;
color: rgba(51, 51, 51, 1);
}
}
}
}
}
</style>

129
uniapp/pages/user/set.vue 普通文件
查看文件

@@ -0,0 +1,129 @@
<!-- 设置 -->
<template>
<view class="set-wrap">
<!-- logo -->
<view class="logo-box u-flex-col u-row-center u-col-center" v-if="initShop.name">
<image class="logo-img" :src="initShop.logo" mode="aspectFit"></image>
<view class="app-name u-m-t-50">{{ initShop.name }}</view>
</view>
<!-- cell -->
<view class="set-box">
<view class="cell-item u-flex u-col-center u-row-between u-p-x-30 u-p-y-20">
<view class="cell-title">占用缓存</view>
<view class="cell-right u-flex u-col-center">
<view class="cell-content">{{ storageSize }}</view>
<text class="u-iconfont uicon-arrow-right u-m-l-10" style="color: #999"></text>
</view>
</view>
<view @click="handleClearStorage" class="cell-item u-flex u-col-center u-row-between u-p-x-30 u-p-y-20">
<view class="cell-title">清除缓存</view>
<view class="cell-right u-flex u-col-center">
<view class="cell-content"></view>
<text class="u-iconfont uicon-arrow-right u-m-l-10" style="color: #999"></text>
</view>
</view>
<view class="cell-item u-flex u-col-center u-row-between u-p-x-30 u-p-y-20">
<view class="cell-title">当前版本</view>
<view class="cell-right u-flex u-col-center">
<view class="cell-content">{{ initShop.version }}</view>
<text class="u-iconfont uicon-arrow-right u-m-l-10" style="color: #999"></text>
</view>
</view>
<view class="cell-item u-flex u-col-center u-row-between u-p-x-30 u-p-y-20" @tap="$Router.push('/pages/public/feedback')">
<view class="cell-title">意见反馈</view>
<view class="cell-right u-flex u-col-center"><text class="u-iconfont uicon-arrow-right u-m-l-10" style="color: #999"></text></view>
</view>
<view class="cell-item u-flex u-col-center u-row-between u-p-x-30 u-p-y-20" @tap="$Router.push(`/pages/public/richtext?id=${initShop.about_us}`)">
<view class="cell-title">关于我们</view>
<view class="cell-right u-flex u-col-center"><text class="u-iconfont uicon-arrow-right u-m-l-10" style="color: #999"></text></view>
</view>
<view class="cell-item u-flex u-col-center u-row-between u-p-x-30 u-p-y-20" @tap="$Router.push(`/pages/public/richtext?id=${initShop.privacy_protocol}`)">
<view class="cell-title">隐私协议</view>
<view class="cell-right u-flex u-col-center"><text class="u-iconfont uicon-arrow-right u-m-l-10" style="color: #999"></text></view>
</view>
</view>
<!-- copyright -->
<view class="copyright-box u-flex-col u-row-center u-col-center u-p-t-80 u-p-b-50" v-if="initShop.copyright">
<view class="copyright-text">{{ initShop.copyright[0] }}</view>
<view class="copyright-text">{{ initShop.copyright[1] }}</view>
</view>
<!-- 登录提示 -->
<shopro-auth-modal></shopro-auth-modal>
</view>
</template>
<script>
import { mapState, mapActions, mapGetters } from 'vuex';
export default {
components: {},
data() {
return {
storageSize: uni.getStorageInfoSync().currentSize + 'Kb'
};
},
computed: {
...mapGetters(['initShop'])
},
methods: {
handleClearStorage() {
uni.showModal({
title: '温馨提示',
confirmColor: '#f0c785',
content: `您是否确定要清除缓存?`,
success: res => {
if (res.confirm) {
let data = uni.getStorageInfoSync();
let keyArr = ['userInfo', 'token', 'isLogin']
for (let item of data.keys) {
if (!keyArr.includes(item)) {
uni.removeStorageSync(item);
}
}
uni.showToast({
title: '缓存清除完毕'
});
this.storageSize = uni.getStorageInfoSync().currentSize + 'Kb';
}
}
});
}
}
};
</script>
<style lang="scss">
.set-box {
background-color: #fff;
.cell-item {
border-bottom: 1px solid #f5f5f5;
.cell-title {
font-size: 28rpx;
color: #333;
}
.cell-content {
color: #999;
}
}
}
.logo-box {
padding: 110rpx 0;
.app-name {
font-size: 36rpx;
font-weight: 600;
color: #333333;
}
}
.copyright-box {
.copyright-text {
font-size: 22rpx;
font-weight: 500;
color: #c4c4c4;
}
}
</style>

查看文件

@@ -0,0 +1,192 @@
<!-- 浏览记录 -->
<template>
<view class="page_box">
<view class="head_box u-flex u-row-right" v-show="!isEmpty">
<button class="edit-btn u-reset-button" @tap="onSet">{{ isEdit ? '完成' : '编辑' }}</button>
</view>
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<u-checkbox-group @change="checkboxGroupChange" activeColor="#4C7AF3">
<view class="collect-list u-flex u-flex-1" v-for="f in browseList" :key="f.id">
<u-checkbox v-if="isEdit" :name="f.goods_id" shape="circle" v-model="f.checked"></u-checkbox>
<shopro-mini-card
:image="f.goods.image"
:title="f.goods.title"
:price="f.goods.price"
:originPrice="f.goods.original_price"
:subtitle="f.goods.subtitle"
@click="$Router.push({ path: '/pages/goods/detail', query: { id: f.goods_id } })"
></shopro-mini-card>
</view>
</u-checkbox-group>
<!-- 缺省页 -->
<shopro-empty
v-if="isEmpty"
:image="$IMG_URL + '/imgs/empty/empty_goods.png'"
tipText="暂无浏览记录"
btnText="去首页逛逛"
@click="$Router.pushTab('/pages/index/index')"
></shopro-empty>
<!-- 更多 -->
<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
</scroll-view>
</view>
<view class="foot_box ">
<view class="tools-box u-flex u-row-between u-flex-1" v-show="isEdit && !isEmpty">
<u-checkbox shape="circle" activeColor="#4C7AF3" @change="onAllSel" v-model="isAllSel"><text>全选</text></u-checkbox>
<button class="u-reset-button close-btn" @tap="deleteLog">删除</button>
</view>
</view>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
isEmpty: false, //无数据
isEdit: false, //是否编辑
isAllSel: false, //是否全选
selList: [], //选中列表
browseList: [],
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {},
onLoad() {
this.getbrowseList();
},
methods: {
// 单选
checkboxGroupChange(e) {
this.selList = e;
this.isAllSel = this.browseList.every(item => item.checked);
},
// 编辑
onSet() {
this.isEdit = !this.isEdit;
},
// 全选
onAllSel(e) {
this.isAllSel = e.value;
this.selList = [];
this.browseList.forEach(item => {
e.value && this.selList.push(item.goods_id);
this.$set(item, 'checked', e.value);
});
},
// 历史记录
getbrowseList() {
let that = this;
let list = [];
that.loadStatus = 'loading';
that.$http('user.viewList', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
list = res.data.data;
list.map(item => {
that.$set(item, 'checked', false);
});
that.browseList = [...that.browseList, ...list];
that.isEmpty = !that.browseList.length;
that.lastPage = res.data.last_page;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
},
// 删除足迹
deleteLog() {
let that = this;
const { browseList, selList } = this;
that.$http(
'user.viewDelete',
{
goods_ids: selList
},
'删除中...'
).then(res => {
if (res.code === 1) {
if (that.isAllSel) {
that.browseList = [];
that.isEmpty = true;
} else {
that.browseList = browseList.filter(f => !selList.includes(f.goods_id));
}
}
});
},
// 加载更多
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getbrowseList();
}
}
}
};
</script>
<style lang="scss">
.head_box {
height: 70rpx;
padding: 0 30rpx;
.count-box {
font-size: 26rpx;
color: #999;
.all-num {
color: #4C7AF3;
}
}
.edit-btn {
background: none;
font-size: 26rpx;
color: #4C7AF3;
margin: 0;
padding: 20rpx;
}
}
.collect-list {
padding: 30rpx 20rpx;
background: #fff;
width: 750rpx;
margin-bottom: 20rpx;
.goods-radio {
transform: scale(0.7);
margin-right: 20rpx;
}
}
.tools-box {
height: 100rpx;
width: 750rpx;
padding: 0 20rpx;
background: #fff;
.check-all {
font-size: 26rpx;
.check-all-radio {
transform: scale(0.7);
}
}
.close-btn {
width: 200rpx;
line-height: 70rpx;
background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
box-shadow: 0px 7rpx 6rpx 0px rgba(229, 138, 0, 0.22);
border-radius: 35rpx;
padding: 0;
margin: 0;
color: rgba(#fff, 0.9);
}
}
</style>

查看文件

@@ -0,0 +1,350 @@
<!-- 我的钱包 -->
<template>
<view class="wallet-wrap">
<!-- 钱包卡片 -->
<view class="head_box u-flex u-row-center u-col-center">
<view class="card-box">
<view class="card-head u-flex u-col-center">
<view class="card-title u-m-r-10">可提现金额(元)</view>
<view @tap="showMoney = !showMoney" class="u-iconfont"
:class="showMoney ? 'uicon-eye' : 'uicon-eye-off'" style="color: #fff;font-size: 46rpx;"></view>
</view>
<view class="money-num u-p-t-50">{{ showMoney ? userInfo.money || '0.00' : '*****' }}</view>
<button v-if="initRecharge.enable ==='1'" class="u-reset-button topup-btn"
@tap="$Router.push('/pages/user/wallet/top-up')">充值</button>
<button class="u-reset-button withdraw-btn"
@tap="$Router.push('/pages/user/wallet/withdraw')">提现</button>
</view>
</view>
<!-- 筛选 -->
<u-sticky offset-top="0" :enable="true">
<view class="filter-box u-flex u-row-between">
<button class="u-reset-button date-btn u-flex" @tap="showCalendar = true">
{{ selDateText }}
<text class="u-iconfont uicon-arrow-down-fill u-m-l-20" style="color: #e5e5e5"></text>
</button>
<view class="total-box">收入¥{{ incomeMoney || '0.00' }} 支出¥{{ expendMoney || '0.00' }}</view>
</view>
<!-- 状态分类 -->
<view class="u-flex nav-box">
<view class="state-item u-flex-1 " v-for="(state, index) in statusList" :key="state.value"
@tap="onTab(state.value)">
<text class="state-title"
:class="{ 'title-active': stateCurrent === state.value }">{{ state.name }}</text>
<text class="underline" :class="{ 'underline-active': stateCurrent === state.value }"></text>
</view>
</view>
</u-sticky>
<!-- 钱包记录 -->
<view class="wallet-list u-flex" v-for="item in walletLog" :key="item.id">
<image class="head-img u-m-r-20" :src="item.avatar" mode=""></image>
<view class="list-content">
<view class="title-box u-flex u-row-between">
<text class="title u-ellipsis-1">{{ item.type_name }}{{ item.title ? '-' + item.title : '' }}</text>
<view class="money">
<text v-if="item.wallet >= 0" class="add font-OPPOSANS">+{{ item.wallet }}</text>
<text v-else class="minus font-OPPOSANS">{{ item.wallet }}</text>
</view>
</view>
<text class="time">{{ $u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM') }}</text>
</view>
</view>
<!-- 空置页 -->
<shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'" tipText="暂无数据~">
</shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
<!-- 日期选择 -->
<u-calendar v-model="showCalendar" ref="uCalendar" safeAreaInsetBottom mode="range" start-text="开始"
end-text="结束" active-bg-color="#EB2B3D" active-color="#fff" range-bg-color="rgba(255,0,0,.3)" range-color="#EB2B3D"
:customStyle="{ background: 'linear-gradient(90deg, #EB2B3D, #EB2B3D)', boxShadow: '0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34)' }"
@change="selDate"></u-calendar>
</view>
</template>
<script>
import {
mapState,
mapActions,
mapGetters
} from 'vuex';
export default {
components: {},
data() {
return {
isEmpty: false,
stateCurrent: 'all', //默认
statusList: [{
name: '全部',
value: 'all'
},
{
name: '收入',
value: 'add'
},
{
name: '支出',
value: 'reduce'
}
],
showMoney: true,
//日期选择
showCalendar: false,
selDateText: '',
walletLog: [], //钱包记录
propsDate: '', //日期参数
incomeMoney: '', //收入
expendMoney: '', //支出
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {
...mapGetters(['isLogin', 'userInfo', 'initRecharge'])
},
onShow() {
this.isLogin && this.getUserInfo();
this.getToday();
this.currentPage = 1;
this.lastPage = 1;
this.walletLog = [];
this.getWalletLog();
},
// 触底加载更多
onReachBottom() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getWalletLog();
}
},
methods: {
...mapActions(['getUserInfo']),
// 今日
getToday() {
let now = new Date();
let dateText = `${now.getFullYear()}/${now.getMonth() + 1}/${now.getDate()}`;
this.selDateText = `${now.getFullYear()}.${now.getMonth() + 1}.${now.getDate()}`;
this.propsDate = `${dateText}-${dateText}`;
},
// tab切换
onTab(state) {
if (this.stateCurrent !== state) {
this.stateCurrent = state;
this.currentPage = 1;
this.lastPage = 1;
this.walletLog = [];
this.getWalletLog();
}
},
// 日期选择
selDate(e) {
this.walletLog = [];
this.currentPage = 1;
this.lastPage = 1;
this.selDateText = `${e.startYear}.${e.startMonth}.${e.startDay}-${e.endYear}.${e.endMonth}.${e.endDay}`;
let dateText = `${e.startYear}/${e.startMonth}/${e.startDay}-${e.endYear}/${e.endMonth}/${e.endDay}`;
this.propsDate = dateText;
this.getWalletLog();
this.$refs.uCalendar.init();
},
// 钱包明细
getWalletLog() {
let that = this;
that.loadStatus = 'loading';
that.$http('money.walletLog', {
wallet_type: 'money',
status: that.stateCurrent,
date: that.propsDate,
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.walletLog = [...that.walletLog, ...res.data.wallet_logs.data];
that.incomeMoney = res.data.income;
that.expendMoney = Math.abs(res.data.expend);
that.isEmpty = !that.walletLog.length;
that.lastPage = res.data.wallet_logs.last_page;
that.loadStatus = that.currentPage < res.data.wallet_logs.last_page ? 'loadmore' :
'nomore';
}
});
}
}
};
</script>
<style lang="scss">
// 钱包记录
.wallet-list {
width: 750rpx;
padding: 30rpx;
background-color: #ffff;
border-bottom: 1rpx solid #eeeeee;
.head-img {
width: 70rpx;
height: 70rpx;
border-radius: 50%;
background: #ccc;
}
.list-content {
justify-content: space-between;
align-items: flex-start;
flex: 1;
.title {
font-size: 28rpx;
color: #333;
width: 400rpx;
}
.time {
color: #c0c0c0;
font-size: 22rpx;
}
}
.money {
font-size: 28rpx;
font-weight: bold;
.add {
color: #FF3934;
}
.minus {
color: #333333;
}
}
}
// 钱包
.head_box {
width: 750rpx;
background-color: #fff;
padding: 30rpx 0;
.card-box {
width: 690rpx;
min-height: 300rpx;
padding: 40rpx;
// background: url($IMG_URL+'/imgs/user/money_wallet_bg.png') no-repeat;
background: linear-gradient(90deg, #FF3934, #FF7D00);
background-size: 100% 100%;
// box-shadow: 1rpx 5rpx 16rpx 0 rgba(94, 73, 195, 0.81);
border-radius: 30rpx;
overflow: hidden;
position: relative;
.card-head {
color: #fff;
font-size: 30rpx;
}
.money-num {
font-size: 70rpx;
line-height: 70rpx;
font-weight: 500;
color: #ffffff;
}
.reduce-num {
font-size: 26rpx;
font-weight: 400;
color: #ffffff;
}
.withdraw-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
background: #ffffff;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
color: #FF3934;
position: absolute;
right: 30rpx;
top: 40rpx;
}
.topup-btn {
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 30px;
font-size: 24rpx;
font-weight: 500;
color: #fff;
border: 1px solid #fff;
position: absolute;
right: 180rpx;
top: 40rpx;
}
}
}
// 筛选
.filter-box {
height: 120rpx;
padding: 0 30rpx;
background-color: #f6f6f6;
.date-btn {
background-color: #fff;
line-height: 54rpx;
border-radius: 27rpx;
padding: 0 20rpx;
font-size: 24rpx;
font-weight: 500;
color: #666666;
}
.total-box {
font-size: 24rpx;
font-weight: 500;
color: #999999;
}
}
// 分类
.state-item {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #fff;
border-bottom: 1rpx solid rgba(#999, 0.5);
.state-title {
color: #666;
font-weight: 500;
font-size: 28rpx;
line-height: 90rpx;
}
.title-active {
color: #333;
}
.underline {
display: block;
width: 68rpx;
height: 4rpx;
background: #fff;
border-radius: 2rpx;
}
.underline-active {
background: #FF3934;
display: block;
width: 68rpx;
height: 4rpx;
border-radius: 2rpx;
}
}
</style>

查看文件

@@ -0,0 +1,175 @@
<!-- 积分余额 -->
<template>
<view class="page_box">
<view class="head_box">
<shopro-navbar :background="{ background: 'none' }" backText="积分余额" backIconColor="#333"></shopro-navbar>
<view class="all-box u-flex-col u-row-center u-col-center">
<text class="all-num">{{ userInfo.score || 0 }}</text>
<text class="all-title u-m-b-30">当前积分</text>
<image class="score-card-bg" :src="$IMG_URL + '/imgs/score/score_wallet_bg.png'" mode=""></image>
</view>
<view class="tab-box u-flex">
<view class="tab-item u-flex u-row-center " @tap="onTab('all')"><view class="tab-name" :class="{ 'tab-active': tabCur === 'all' }">全部</view></view>
<view class="tab-item u-flex u-row-center" @tap="onTab('add')"><view class="tab-name" :class="{ 'tab-active': tabCur === 'add' }">收入</view></view>
<view class="tab-item u-flex u-row-center" @tap="onTab('reduce')"><view class="tab-name" :class="{ 'tab-active': tabCur === 'reduce' }">支出</view></view>
</view>
</view>
<view class="content_box">
<scroll-view scroll-y="true" @scrolltolower="loadMore" class="scroll-box">
<view class="item-box u-flex u-row-between" v-for="log in scoreLog" :key="log.id">
<view class="u-flex-col">
<view class="name">{{ log.type_name }}</view>
<view class="time">{{ $u.timeFormat(log.createtime) }}</view>
</view>
<view class="num font-OPPOSANS" v-if="log.wallet >= 0">{{ log.wallet }}</view>
<view class="num font-OPPOSANS" v-else>{{ log.wallet }}</view>
</view>
<!-- 空置页 -->
<shopro-empty v-if="isEmpty" marginTop="200rpx" :image="$IMG_URL + '/imgs/empty/comment_empty.png'" tipText="暂无数据~"></shopro-empty>
<!-- 更多 -->
<u-loadmore v-if="scoreLog.length" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
</scroll-view>
</view>
</view>
</template>
<script>
import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
export default {
components: {},
data() {
return {
isEmpty: false,
tabCur: 'all',
scoreLog: [],
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1
};
},
computed: {
...mapGetters(['userInfo'])
},
onLoad() {
this.getScoreLog();
},
methods: {
loadMore() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getScoreLog();
}
},
onTab(type) {
if (this.tabCur !== type) {
this.tabCur = type;
this.scoreLog = [];
this.currentPage = 1;
this.getScoreLog();
}
},
// 积分明细
getScoreLog(type) {
let that = this;
that.loadStatus = 'loading';
that.$http('money.walletLog', {
wallet_type: 'score',
status: that.tabCur,
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.scoreLog = [...that.scoreLog, ...res.data.wallet_logs.data];
that.lastPage = res.data.last_page;
that.isEmpty = !that.scoreLog.length;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
}
}
};
</script>
<style lang="scss">
.page_box {
background: #fff;
.head_box {
width: 750rpx;
height: 480rpx;
background: linear-gradient(180deg, rgba(239, 196, 128, 1) 0%, rgba(248, 220, 165, 1) 40%, rgba(255, 255, 255, 1) 100%) no-repeat;
position: relative;
.all-box {
height: 360rpx;
padding-bottom: var(--status-bar-height);
.all-num {
font-size: 50rpx;
font-weight: 500;
color: #4C7AF3;
margin-bottom: 20rpx;
}
.all-title {
font-size: 24rpx;
font-weight: 500;
color: rgba(168, 112, 13, 1);
}
.score-card-bg {
width: 100%;
height: 90rpx;
}
}
.tab-box {
position: absolute;
left: 50%;
bottom: 0;
transform: translateX(-50%);
width: 710rpx;
height: 90rpx;
background: rgba(255, 255, 255, 1);
border-radius: 30rpx 30rpx 0px 0px;
border-bottom: 1rpx solid #dfdfdf;
padding: 0 30rpx;
.tab-item {
flex: 1;
.tab-name {
display: inline-block;
font-size: 30rpx;
font-family: Noto Sans S Chinese;
font-weight: 400;
color: rgba(51, 51, 51, 1);
border-bottom: 4rpx solid transparent;
line-height: 86rpx;
}
.tab-active {
border-bottom: 4rpx solid rgba(213, 166, 90, 1);
}
}
}
}
}
.item-box {
background: #fff;
min-height: 150rpx;
border-bottom: 1rpx solid #dfdfdf;
padding: 30rpx;
.name {
font-size: 28rpx;
font-weight: 500;
color: rgba(102, 102, 102, 1);
line-height: 28rpx;
margin-bottom: 20rpx;
}
.time {
font-size: 24rpx;
font-weight: 500;
color: rgba(196, 196, 196, 1);
line-height: 24px;
}
.num {
font-size: 30rpx;
font-weight: 500;
color: #4C7AF3;
}
}
</style>

查看文件

@@ -0,0 +1,127 @@
<!-- 充值记录 -->
<template>
<view class="wallet-log-box u-p-b-30">
<view class="log-list" v-for="item in rechargeLog" :key="item.id">
<view class="head u-flex u-col-center u-row-between">
<view class="title">{{item.pay_type_text}}充值</view>
<view class="num">{{ item.total_fee }} 元</view>
</view>
<view class="time-box item u-flex u-col-center u-row-between">
<view class="item-title u-flex u-col-center"><text class="u-iconfont uicon-order u-m-r-10"></text>充值单号
</view>
<view class="time">{{item.order_sn}}</view>
</view>
<view class="time-box item u-flex u-col-center u-row-between">
<view class="item-title u-flex u-col-center"><text class="u-iconfont uicon-clock u-m-r-10"></text>充值时间
</view>
<view class="time">{{$u.timeFormat(item.createtime, 'yyyy.mm.dd hh:MM:ss')}}</view>
</view>
</view>
<!-- 更多 -->
<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
<!-- 空置页 -->
<shopro-empty v-if="isEmpty" marginTop="300rpx" :image="$IMG_URL + '/imgs/empty/no_data.png'" tipText="暂无数据~">
</shopro-empty>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
rechargeLog: [],
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
isEmpty: false,
};
},
computed: {},
onLoad() {
this.getLog();
},
// 触底加载更多
onReachBottom() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getLog();
}
},
methods: {
// 确认提交表单
getLog() {
let that = this;
that.loadStatus = 'loading';
that.$http('money.rechargeLog', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.rechargeLog = [...that.rechargeLog, ...res.data.data];
that.isEmpty = !that.rechargeLog.length;
that.lastPage = res.data.last_page;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
}
}
};
</script>
<style lang="scss">
// 记录卡片
.log-list {
min-height: 213rpx;
background: #ffffff;
margin-bottom: 10rpx;
padding-bottom: 10rpx;
.head {
padding: 0 35rpx;
height: 80rpx;
border-bottom: 1rpx solid #eee;
margin-bottom: 20rpx;
.title {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
.num {
font-size: 28rpx;
font-weight: 500;
color: #7063d2;
}
}
.item {
padding: 0 30rpx 10rpx;
.item-icon {
color: #c0c0c0;
font-size: 36rpx;
margin-right: 8rpx;
}
.item-title {
width: 180rpx;
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
.status-text {
font-size: 24rpx;
font-weight: 500;
color: #05c3a1;
}
.time {
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
}
}
</style>

查看文件

@@ -0,0 +1,284 @@
<!-- 充值 -->
<template>
<view class="draw-money-wrap u-p-b-30">
<view class="head-box">
<shopro-navbar :background="{ background: navBackground }" :backTextStyle="{ color: '#fff' }" backText="充值"
backIconColor="#fff"></shopro-navbar>
<!-- 账户 -->
<view class="wallet-num-box u-flex u-col-center u-row-between">
<view class="">
<view class="num-title">账户余额(元)</view>
<view class="wallet-num">{{ userInfo.money || '0.00' }}</view>
</view>
<button class="u-reset-button log-btn"
@tap="$Router.push({ path: '/pages/user/wallet/top-up-log' })">充值记录</button>
</view>
</view>
<!-- 充值输入卡片-->
<view class="draw-card">
<view class="card-title">充值金额</view>
<view class="input-box u-flex u-col-center">
<view calss="unit">¥</view>
<input class="u-flex-1 u-p-l-10" type="digit" @focus="onTopupFous" @input="onTopupInput" v-model="money"
placeholder-style="font-size: 30rpx; font-weight: 500;color:#C2C7CF;" placeholder="请输入充值金额" />
</view>
<!-- 快捷充值 -->
<view class="top-up-content u-p-b-30" v-if="initRecharge.moneys.length">
<view class="card-title">快捷充值</view>
<view class="u-flex u-flex-wrap">
<view class="top-up-card u-flex u-row-center u-col-center u-m-b-30 u-m-r-30"
:class="{'top-up-active':curMoneyCard === index}" v-for="(item,index) in initRecharge.moneys"
:key="index" @tap="selectCard(index)">
<view class="top-up-value">
{{item.money}}
</view>
</view>
</view>
</view>
<button class="u-reset-button save-btn" :style="{opacity:!money ? 0.7 : 1 }" :disabled="!money"
@tap="confirmTopup">确认充值</button>
</view>
<!-- 充值说明 -->
<view class="draw-notice">
<view class="title">充值说明</view>
<view class="draw-list">1.充值为在线支付,即时到账,不支持退款;</view>
<view class="draw-list">
2.充值后金额会自动进入您的余额账户,请注意查收。
</view>
</view>
</view>
</template>
<script>
import { mapState, mapActions, mapGetters } from 'vuex';
import FormValidate from '@/shopro/validate/form';
import wechat from '@/shopro/wechat/wechat';
export default {
components: {},
data() {
return {
money: '', //提现金额
showModal: false,
curMoneyCard: '',
navBackground: 'none'
};
},
computed: {
...mapGetters(['userInfo', 'initRecharge'])
},
async onLoad() {},
onPageScroll(e) {
this.navBackground = e.scrollTop > 50 ?
`url(${this.$IMG_URL}/imgs/user/draw_money_head_bg.png) no-repeat top / 100% auto` : 'none';
},
methods: {
// 充值输入框
onTopupInput(e) {
this.$nextTick(() => {
this.money = this.clearNoNum(e.detail.value)
})
},
// 获取焦点
onTopupFous() {
this.curMoneyCard = ''
},
// 选择充值卡片
selectCard(index) {
this.curMoneyCard = index
this.money = this.initRecharge.moneys[index].money
},
confirmTopup() {
const that = this;
if (this.money <= 0) {
this.$u.toast('请选择或输入充值金额');
return;
}
that.$http(
'money.recharge', {
recharge_money: that.money
},
'确认中...'
).then(res => {
if (res.code === 1) {
that.money = '';
that.$Router.push({
path: `/pages/order/payment/method`,
query: {
orderId: res.data.id,
orderType: 'recharge'
}
});
} else {
that.$u.toast(res.msg);
}
});
},
// 校验金额
clearNoNum(val) {
if (val == ".") {
val = "0.";
}
val = val.replace(/[^\d.]/g, "");
//必须保证第一个为数字而不是.
val = val.replace(/^\./g, "");
//保证只有出现一个.而没有多个.
val = val.replace(/\.{2,}/g, ".");
//保证.只出现一次,而不能出现两次以上
val = val
.replace(".", "$#$")
.replace(/\./g, "")
.replace("$#$", ".");
//只能输入两位小数
val = val.replace(/^(-)*(\d+)\.(\d\d).*$/, "$1$2.$3");
if (val.indexOf(".") < 0 && val != "") {
//以上已经过滤,此处控制的是如果没有小数点,首位不能为类似于 01、02的金额
val = parseFloat(val);
}
return val
}
}
};
</script>
<style lang="scss">
.head-box {
background: url($IMG_URL+'/imgs/user/draw_money_head_bg.png') no-repeat;
background-size: 100% auto;
min-height: 400rpx;
padding-bottom: var(--status-bar-height);
// 可提现
.wallet-num-box {
padding: 20rpx 40rpx 0;
.num-title {
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
margin-bottom: 20rpx;
}
.wallet-num {
font-size: 60rpx;
font-weight: 500;
color: #ffffff;
}
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
background: rgba(255, 255, 255, 0.1);
border: 1rpx solid #eeeeee;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
}
}
}
// 提现输入卡片
.draw-card {
background-color: #fff;
border-radius: 20rpx;
width: 690rpx;
min-height: 400rpx;
margin: -70rpx auto 30rpx;
padding: 30rpx;
.card-title {
font-size: 30rpx;
font-weight: 500;
color: #333333;
margin-bottom: 30rpx;
}
.input-box {
width: 624rpx;
border-bottom: 1rpx solid #eee;
height: 100rpx;
margin-bottom: 40rpx;
.unit {
font-size: 48rpx;
color: #333;
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
background: linear-gradient(-90deg, #a36fff, #5336ff);
box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
border-radius: 43rpx;
font-size: 30rpx;
font-weight: 500;
color: #ffffff;
}
// 充值卡片
.top-up-card {
width: 190rpx;
height: 124rpx;
background: #F7F6FB;
border-radius: 12rpx;
transition: all linear 0.2s;
&:nth-of-type(3n) {
margin-right: 0 !important;
}
.top-up-value {
font-size: 36rpx;
font-weight: 500;
color: #999999;
&::after {
content: '元';
font-size: 24rpx;
}
}
}
.top-up-active {
background: #564BBD;
transition: all linear 0.2s;
.top-up-value {
color: #fff
}
}
}
// 提现说明
.draw-notice {
width: 684rpx;
min-height: 180rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 30rpx 35rpx;
margin: 20rpx auto;
.title {
font-size: 30rpx;
font-weight: 500;
color: #333333;
margin-bottom: 30rpx;
}
.draw-list {
font-size: 24rpx;
font-weight: 400;
color: #999999;
margin-bottom: 10rpx;
}
}
</style>

查看文件

@@ -0,0 +1,150 @@
<!-- 提现记录 -->
<template>
<!-- 记录卡片 -->
<view class="wallet-log-box u-p-b-30">
<view class="log-list" v-for="item in withdrawLog" :key="item.id">
<view class="head u-flex u-col-center u-row-between">
<view class="title">提现至{{ item.apply_type_text }}</view>
<view class="num">{{ item.money }} 元</view>
</view>
<view class="status-box item u-flex u-col-center u-row-between">
<view class="item-title">申请状态</view>
<view class="status-text" :style="{ color: stausMap[item.status] }">{{ item.status_text }}</view>
</view>
<view class="time-box item u-flex u-col-center u-row-between">
<text class="item-title">账户信息</text>
<view class="time u-ellipsis-1">{{ item.apply_info | applyInfoFilter }}</view>
</view>
<view class="time-box item u-flex u-col-center u-row-between">
<text class="item-title">提现单号</text>
<view class="time">{{ item.apply_sn }}</view>
</view>
<view class="time-box item u-flex u-col-center u-row-between">
<text class="item-title">手续费</text>
<view class="time">{{ item.charge_money }} 元</view>
</view>
<view class="time-box item u-flex u-col-center u-row-between">
<text class="item-title">申请时间</text>
<view class="time">{{ $u.timeFormat(item.createtime, 'yyyy.mm.dd hh:MM:ss') }}</view>
</view>
</view>
<!-- 更多 -->
<u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc" />
<!-- 空置页 -->
<shopro-empty v-if="isEmpty" marginTop="300rpx" :image="$IMG_URL + '/imgs/empty/empty_goods_null.png'"
tipText="暂无数据~"></shopro-empty>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
withdrawLog: [],
loadStatus: 'loadmore', //loadmore-加载前的状态,loading-加载中的状态,nomore-没有更多的状态
currentPage: 1,
lastPage: 1,
isEmpty: false,
stausMap: {
0: '#999',
1: '#EFAF41',
2: '#70C140',
'-1': '#ED5B56'
}
};
},
computed: {},
filters: {
applyInfoFilter: function(value) {
if (!value) return '-';
return Object.values(value).join(' | ');
}
},
onLoad() {
this.getLog();
},
// 触底加载更多
onReachBottom() {
if (this.currentPage < this.lastPage) {
this.currentPage += 1;
this.getLog();
}
},
methods: {
// 确认提交表单
getLog() {
let that = this;
that.loadStatus = 'loading';
that.$http('money.withdrawLog', {
page: that.currentPage
}).then(res => {
if (res.code === 1) {
that.withdrawLog = [...that.withdrawLog, ...res.data.data];
that.isEmpty = !that.withdrawLog.length;
that.lastPage = res.data.last_page;
that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
}
});
}
}
};
</script>
<style lang="scss">
// 记录卡片
.log-list {
min-height: 213rpx;
background: #ffffff;
margin-bottom: 10rpx;
padding-bottom: 10rpx;
.head {
padding: 0 35rpx;
height: 80rpx;
border-bottom: 1rpx solid #eee;
margin-bottom: 20rpx;
.title {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
.num {
font-size: 28rpx;
font-weight: 500;
color: #FF3934;
}
}
.item {
padding: 0 30rpx 10rpx;
.item-icon {
color: #c0c0c0;
font-size: 36rpx;
margin-right: 8rpx;
}
.item-title {
width: 180rpx;
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
.status-text {
font-size: 24rpx;
font-weight: 500;
color: #05c3a1;
}
.time {
font-size: 24rpx;
font-weight: 400;
color: #c0c0c0;
}
}
}
</style>

查看文件

@@ -0,0 +1,609 @@
<!-- 提现 -->
<template>
<view class="draw-money-wrap">
<view class="head-box">
<shopro-navbar :background="{ background: 'none' }" :backTextStyle="{ color: '#fff' }" backText="提现"
backIconColor="#fff"></shopro-navbar>
<!-- 可提现 -->
<view class="wallet-num-box u-flex u-col-center u-row-between">
<view class="">
<view class="num-title">可提现金额(元)</view>
<view class="wallet-num">{{ userInfo.money || '0.00' }}</view>
</view>
<button class="u-reset-button log-btn"
@tap="$Router.push({ path: '/pages/user/wallet/withdraw-log' })">提现记录</button>
</view>
</view>
<!-- 提现输入卡片-->
<view class="draw-card">
<view class="card-title">提现金额</view>
<view class="input-box u-flex u-col-center">
<view calss="unit">¥</view>
<input class="u-flex-1 u-p-l-10" type="number" @input="onWithdrawInput" v-model="money"
:placeholder-style="placeholderStyle" placeholder="请输入提现金额" />
</view>
<view class="bank-box u-flex u-col-center u-row-between u-m-b-30">
<view class="name">提现至</view>
<view class="bank-list u-flex" @tap="showWithdrawList = true">
<view class="empty-text" v-if="!withdrawType">请选择提现方式</view>
<view class="sel-box u-flex u-col-center" v-else>
<image class="item-img" :src="withdrawList[withdrawType].icon" mode=""></image>
<view class="item-title u-m-l-20">{{ withdrawList[withdrawType].title }}</view>
</view>
<text class="u-iconfont uicon-arrow-right" style="#C4C4C4;"></text>
</view>
</view>
<!-- 提现信息 -->
<view class="bank-info u-m-b-80">
<view class="u-flex u-row-between u-col-center" v-if="withdrawType">
<block v-if="withdrawType === 'wechat'">
<view class="bank-info-title">
{{ !withdrawInfo ? '暂无微信授权信息' : `${withdrawInfo.bank_name || ''} [${withdrawInfo.card_no || ''}] ${withdrawInfo.real_name || ''}` }}
</view>
<button v-if="!withdrawInfo" class="u-reset-button bind-btn u-m-l-20"
@tap="bindThirdOauth()">绑定</button>
</block>
<block v-else>
<view class="bank-info-title">
{{
!withdrawInfo
? `暂无${withdrawList[withdrawType].title}信息`
: `${withdrawInfo.bank_name || ''} [${withdrawInfo.card_no || ''}] ${withdrawInfo.real_name || ''}`
}}
</view>
<button class="u-reset-button bind-btn u-m-l-20"
@tap="toBind">{{ withdrawInfo ? '修改' : '添加' }}</button>
</block>
</view>
</view>
<button class="u-reset-button save-btn" @tap="withdraw">确认提现</button>
</view>
<!-- 提现说明(平台审核要求:含额度、次数、时间、到账等) -->
<view class="draw-notice">
<view class="title">提现说明</view>
<view class="draw-subtitle">请仔细阅读以下提现规则后再操作</view>
<view class="draw-list">1. 可提现额度:{{ ruleDisplay.amountLimit }};</view>
<view class="draw-list">2. 每日提现次数:{{ ruleDisplay.dailyCount }};每日提现金额:{{ ruleDisplay.dailyAmount }};</view>
<view class="draw-list">3. 提现时间:{{ ruleDisplay.withdrawTime }};</view>
<view class="draw-list">4. 到账时间:{{ ruleDisplay.arrivalTime }};</view>
<view class="draw-list">5. {{ ruleDisplay.serviceFee }};提现结果请留意微信/支付宝或银行卡到账通知;</view>
<view class="draw-list">6. 如有疑问请联系在线客服处理。</view>
</view>
<!-- 提现方式 -->
<u-popup v-if="ruleInfo.methods && ruleInfo.methods.length" v-model="showWithdrawList" mode="bottom"
safe-area-inset-bottom :closeable="false" border-radius="30">
<view class="page_box withdraw-modal">
<view class="modal-head u-flex u-row-center u-col-center">选择提现方式</view>
<view class="content_box modal-content">
<u-radio-group v-model="selectedWithdrawType" activeColor="#A36FFF" wrap>
<view class="type-item u-p-x-24 u-p-y-30" v-if="ruleInfo.methods.includes(item.value)"
v-for="(item, index) in withdrawList" :key="index">
<u-radio shape="circle" iconSize="30" :name="item.value" labelWidth="100%">
<view class="item-left u-flex u-col-center u-m-l-30">
<image class="item-img" :src="item.icon" mode=""></image>
<view class="item-title u-m-l-20">{{ item.title }}</view>
</view>
</u-radio>
</view>
</u-radio-group>
</view>
<view class="modal-bottom"><button class="u-reset-button modal-save-btn"
@tap="onSaveWithdrawType">确定</button></view>
</view>
</u-popup>
<!-- 绑定修改银行信息 -->
<u-popup v-model="showBindForm" mode="bottom" safe-area-inset-bottom @close="initForm" :closeable="false"
border-radius="30">
<!-- 标题 -->
<view class="form-box u-p-20">
<view class="head-title u-flex u-col-center u-row-center">{{ formTitle }}</view>
<!-- 绑定银行卡 -->
<u-form v-if="withdrawType === 'bank'" :model="form.data" :rules="form.bankRules" ref="bank"
:errorType="errorType">
<u-form-item :labelStyle="labelStyle" label-width="150" label-position="left" label="持卡人:"
prop="real_name">
<u-input placeholder="请输入持卡人" :placeholderStyle="placeholderStyle" v-model="form.data.real_name"
type="text"></u-input>
</u-form-item>
<u-form-item :labelStyle="labelStyle" label-width="150" label-position="left" label="开户行:"
prop="bank_name">
<u-input placeholder="请输入开户行" :placeholderStyle="placeholderStyle" v-model="form.data.bank_name"
type="text"></u-input>
</u-form-item>
<u-form-item :labelStyle="labelStyle" label-position="left" label="银行卡号:" prop="card_no"
label-width="150">
<u-input placeholder="请输入银行卡号" :placeholderStyle="placeholderStyle" v-model="form.data.card_no"
type="number"></u-input>
</u-form-item>
</u-form>
<!-- 绑定支付宝 -->
<u-form v-if="withdrawType === 'alipay'" :model="form.data" :rules="form.aliPayRules" ref="alipay"
:errorType="errorType">
<u-form-item :labelStyle="labelStyle" label-width="150" label-position="left" label="真实姓名:"
prop="real_name">
<u-input placeholder="请输入真实姓名" :placeholderStyle="placeholderStyle"
v-model="form.data.real_name" type="text"></u-input>
</u-form-item>
<u-form-item :labelStyle="labelStyle" label-position="left" label="支付宝账号:" prop="card_no"
label-width="170">
<u-input placeholder="请输入支付宝账号" :placeholderStyle="placeholderStyle" v-model="form.data.card_no"
type="text"></u-input>
</u-form-item>
</u-form>
<view class="u-flex u-col-center u-row-between">
<button class="u-reset-button form-cancel-btn u-m-y-40" @tap="showBindForm = false">取消</button>
<button class="u-reset-button form-save-btn u-m-y-40" @tap="saveForm">确定</button>
</view>
</view>
</u-popup>
<!-- modal -->
<u-modal ref="uModal" v-model="showModal" :show-cancel-button="true" confirm-color="#EB2B3D"
cancel-color="#666666" @confirm="$Router.push('/pages/user/wallet/withdraw-log')" confirm-text="查看记录"
cancel-text="继续提现" content="您的申请提现已提交" title="申请成功"></u-modal>
</view>
</template>
<script>
import {
mapState,
mapActions,
mapGetters
} from 'vuex';
import FormValidate from '@/shopro/validate/form';
import wechat from '@/shopro/wechat/wechat';
export default {
components: {},
data() {
return {
showModal: false,
money: '', //提现金额
ruleInfo: {}, //提现规则
formTitle: '',
withdrawType: '',
showBindForm: false,
selectedWithdrawType: '',
withdrawInfo: {}, //提现信息
showWithdrawList: false,
withdrawList: {
bank: {
icon: this.$IMG_URL + '/imgs/wallet/bank_type.png',
title: '银行卡转账',
value: 'bank'
},
wechat: {
icon: this.$IMG_URL + '/imgs/wallet/wx_type.png',
title: '微信零钱',
value: 'wechat'
},
alipay: {
icon: this.$IMG_URL + '/imgs/wallet/ali_type.png',
title: '支付宝账户',
value: 'alipay'
}
},
// 表单样式
errorType: ['message'],
labelStyle: {
'font-size': '30rpx',
'font-weight': '500',
color: '#333'
},
placeholderStyle: 'font-size: 30rpx; font-weight: 500;color:#C2C7CF;',
form: {
data: {
real_name: '',
bank_name: '',
card_no: ''
},
bankRules: {
real_name: FormValidate.realName,
bank_name: FormValidate.bankName,
card_no: FormValidate.bankCode
},
alipayRules: {
real_name: FormValidate.realName,
card_no: FormValidate.alipayAccount
}
}
};
},
computed: {
...mapGetters(['userInfo', 'initRecharge']),
ruleDisplay() {
const r = this.ruleInfo || {};
const min = r.min != null && r.min !== '' && Number(r.min) > 0 ? r.min : 0;
const max = r.max != null && r.max !== '' && Number(r.max) > 0 ? r.max : '不限';
const withdrawTime = r.withdraw_time || r.withdraw_time_text ||
(r.withdraw_start && r.withdraw_end ? `${r.withdraw_start} 至 ${r.withdraw_end}` : '') ||
'每日 00:00-24:00 可申请提现(系统维护时段除外)';
const arrivalTime = r.arrival_time || r.arrival_time_text || r.arrive_time ||
'审核通过后 1-3 个工作日内到账,具体以支付渠道实际到账时间为准';
const serviceFee = r.service_fee != null && r.service_fee !== '' && Number(r.service_fee) > 0 ?
`每笔收取 ${r.service_fee}% 手续费` :
'当前提现免手续费';
return {
amountLimit: `当前账户可提现 ${this.userInfo.money || '0.00'} 元,单次最低 ${min} 元,最高 ${max} 元`,
dailyCount: r.perday_num != null && r.perday_num !== '' && Number(r.perday_num) > 0 ?
`最多 ${r.perday_num} 次` : '不限',
dailyAmount: r.perday_amount != null && r.perday_amount !== '' && Number(r.perday_amount) > 0 ?
`最多 ${r.perday_amount} 元` : '不限',
withdrawTime,
arrivalTime,
serviceFee
};
}
},
async onLoad() {
this.getWithdrawRules();
},
methods: {
// 确认提现方式
onSaveWithdrawType() {
this.withdrawType = this.selectedWithdrawType;
this.showWithdrawList = false;
this.getWithdrawInfo();
},
async bindThirdOauth() {
let that = this;
wechat.bind();
that.getWithdrawInfo();
},
// 提现检验
onWithdrawInput(e) {
let sVal = String(e.detail.value);
sVal = sVal.replace(/\b(0+)/gi, '');
sVal = sVal.replace(/[^\d]/g, '');
this.money = sVal;
},
// 提现
withdraw() {
const that = this;
if (!this.withdrawType) {
this.$u.toast('请选择提现方式');
return;
}
if (this.money <= 0) {
this.$u.toast('请输入提现金额');
return;
}
that.$http(
'money.walletApply', {
type: that.withdrawType,
money: that.money
},
'申请中...',
false
).then(res => {
if (res.code === 1) {
that.money = '';
that.showModal = true;
// #ifdef MP-WEIXIN
this.$store.commit('subscribeMessage', 'wallet');
// #endif
that.$store.dispatch('getUserInfo');
} else {
that.$u.toast(res.msg);
}
});
},
initForm() {
this.form.data = {
real_name: '',
bank_name: '',
card_no: ''
};
},
// 绑定,修改
toBind() {
this.showBindForm = true;
this.form.data = {
...this.form.data,
...this.withdrawInfo
};
switch (this.withdrawType) {
case 'bank':
this.formTitle = this.withdrawInfo ? '修改银行卡' : '添加银行卡';
this.$nextTick(() => {
this.$refs.bank.setRules(this.form.bankRules);
});
break;
case 'alipay':
this.formTitle = this.withdrawInfo ? '修改支付宝' : '添加支付宝';
this.$nextTick(() => {
this.$refs.alipay.setRules(this.form.alipayRules);
});
break;
default:
break;
}
},
// 确认提交表单
saveForm() {
let that = this;
this.$refs[this.withdrawType].validate().then(res => {
if (res) {
that.$http(
'money.bankEdit', {
type: that.withdrawType,
...that.form.data
},
'提交中...'
).then(res => {
if (res.code === 1) {
that.showBindForm = false;
that.$u.toast(res.msg);
that.initForm();
that.getWithdrawInfo();
}
});
}
});
},
// 提现规则
getWithdrawRules() {
let that = this;
that.$http('money.walletRule').then(res => {
if (res.code === 1 && res.data) {
that.ruleInfo = res.data;
if (that.ruleInfo.methods && that.ruleInfo.methods.length) {
that.selectedWithdrawType = that.ruleInfo.methods[0];
}
}
});
},
// 获取提现信息
getWithdrawInfo() {
let that = this;
that.$http(
'money.bankInfo', {
type: that.withdrawType
},
'',
false
).then(res => {
that.withdrawInfo = res.code === 1 ? res.data : null;
});
}
}
};
</script>
<style lang="scss">
.head-box {
// background: url($IMG_URL+'/imgs/user/draw_money_head_bg.png') no-repeat;
background: linear-gradient(90deg, #FF3934, #FF7D00);
background-size: 100% auto;
min-height: 400rpx;
padding-bottom: var(--status-bar-height);
// 可提现
.wallet-num-box {
padding: 20rpx 40rpx 0;
.num-title {
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
margin-bottom: 20rpx;
}
.wallet-num {
font-size: 60rpx;
font-weight: 500;
color: #ffffff;
}
.log-btn {
width: 170rpx;
height: 60rpx;
line-height: 60rpx;
background: rgba(255, 255, 255, 0.1);
border: 1rpx solid #eeeeee;
border-radius: 30rpx;
padding: 0;
font-size: 26rpx;
font-weight: 500;
color: #ffffff;
}
}
}
// 提现输入卡片
.draw-card {
background-color: #fff;
border-radius: 20rpx;
width: 690rpx;
min-height: 480rpx;
margin: -70rpx auto 0;
padding: 30rpx;
.card-title {
font-size: 30rpx;
font-weight: 500;
color: #333333;
margin-bottom: 30rpx;
}
.input-box {
width: 624rpx;
border-bottom: 1rpx solid #eee;
height: 100rpx;
margin-bottom: 40rpx;
.unit {
font-size: 48rpx;
color: #333;
}
}
.bank-box {
.name {
font-size: 28rpx;
font-weight: 500;
color: #333333;
}
.bank-list {
.empty-text {
font-size: 28rpx;
font-weight: 400;
color: #999999;
}
.sel-box {
.item-img {
width: 36rpx;
height: 36rpx;
}
.item-title {
font-size: 28rpx;
color: #333333;
}
}
}
}
.bank-info {
height: 50rpx;
font-size: 28rpx;
font-weight: 400;
color: #999999;
.bank-info-title {
width: 500rpx;
}
.bind-btn {
padding: 0 20rpx;
line-height: 50rpx;
background: #f5f6f8;
border-radius: 20rpx;
color: #999;
}
}
.save-btn {
width: 616rpx;
height: 86rpx;
line-height: 86rpx;
background: linear-gradient(90deg, #FF3934, #FF7D00);
box-shadow: 0px 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
border-radius: 43rpx;
font-size: 30rpx;
font-weight: 500;
color: #ffffff;
}
}
// 提现说明
.draw-notice {
width: 690rpx;
background: #ffffff;
border-radius: 20rpx;
padding: 28rpx 32rpx 32rpx;
margin: 16rpx auto 40rpx;
box-sizing: border-box;
.title {
font-size: 30rpx;
font-weight: 600;
color: #333333;
margin-bottom: 8rpx;
}
.draw-subtitle {
font-size: 24rpx;
color: #999999;
margin-bottom: 20rpx;
}
.draw-list {
font-size: 26rpx;
font-weight: 400;
color: #666666;
line-height: 1.65;
margin-bottom: 14rpx;
}
}
// 提现费方式
.withdraw-modal {
min-height: 600rpx;
background-color: #fff;
.modal-head {
height: 80rpx;
font-size: 30rpx;
font-weight: 600;
color: #333333;
border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
}
.modal-content {
.type-item {
height: 100rpx;
border-bottom: 1rpx solid rgba(#dfdfdf, 0.5);
width: 750rpx;
.item-img {
width: 36rpx;
height: 36rpx;
}
.item-title {
font-size: 28rpx;
color: #333333;
}
}
}
.modal-bottom {
padding: 30rpx;
.modal-save-btn {
width: 690rpx;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(90deg, #EB2B3D, #EB2B3D);
box-shadow: 0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
border-radius: 40rpx;
font-weight: 500;
color: #ffffff;
}
}
}
// 绑定
.form-box {
.head-title {
height: 100rpx;
font-size: 34rpx;
font-weight: 600;
}
.form-save-btn {
width: 340rpx;
height: 80rpx;
line-height: 80rpx;
background: linear-gradient(90deg, #EB2B3D, #EB2B3D);
box-shadow: 0 7rpx 11rpx 2rpx rgba(124, 103, 214, 0.34);
border-radius: 40rpx;
font-weight: 500;
color: #ffffff;
}
.form-cancel-btn {
width: 340rpx;
height: 80rpx;
line-height: 80rpx;
border: 1rpx solid #999;
border-radius: 40rpx;
font-weight: 500;
color: #999;
}
}
</style>