第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:04:21 +08:00
commit 7a73b38bd5
764 changed files with 166417 additions and 0 deletions

316
package/dealer/apply.vue Executable file
View File

@@ -0,0 +1,316 @@
<template>
<view v-if="!isLoading" class="container b-f">
<!-- 头部背景图 -->
<view class="dealer-bg">
<image class="image" mode="widthFix" :src="background"></image>
</view>
<!-- 等待审核 -->
<view v-if="isApplying" class="dealer-boot dis-flex flex-dir-column flex-y-center">
<view class="boot__msg f-30 dis-flex flex-dir-column flex-y-center">
<text class="msg__icon iconfont icon-shenhezhong"></text>
<text class="msg__content m-top20 f-29 col-80">{{ words.wait_audit.value }}</text>
</view>
<!-- 去商城逛逛 -->
<view class="boot__submit form-submit dis-flex flex-x-center">
<button class="button" @click="$navTo('pages/index/index')">{{ words.goto_mall.value }}</button>
</view>
</view>
<!-- 填写申请信息 -->
<view v-else class="dis-flex flex-dir-column flex-y-center">
<view class="widget-form b-f m-top20 dis-flex flex-dir-column">
<view class="form-title f-30">{{ words.title.value }}</view>
<view class="form-box dis-flex flex-dir-column">
<form @submit="handleSubmit">
<view class="form-field dis-flex flex-y-center">
<view class="field-label">邀请人</view>
<view class="field-input">
<text>{{ refereeName }}请核对</text>
</view>
</view>
<view class="form-field dis-flex flex-y-center">
<view class="field-label">姓名</view>
<view class="field-input flex-box">
<input class="input" name="name" placeholder="请输入真实姓名"></input>
</view>
</view>
<view class="form-field dis-flex flex-y-center">
<view class="field-label">手机号</view>
<view class="field-input flex-box">
<input class="input" name="mobile" placeholder="请输入手机号"></input>
</view>
</view>
<!-- 申请协议 -->
<view class="form-license dis-flex flex-x-center flex-y-center">
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
<text class="license-icon f-38 iconfont icon-radio" :class="[isRead ? 'c-violet' : 'col-bb']"></text>
<text class="f-28 col-80">我已阅读并了解</text>
</view>
<text @click="handleShowLicense()" class="f-28 c-violet">{{ words.license.value }}</text>
</view>
<!-- 立即申请 -->
<view class="form-submit dis-flex flex-x-center">
<button formType="submit" :disabled="disabled">{{ words.submit.value }}</button>
</view>
</form>
</view>
</view>
</view>
<!-- 入驻协议弹窗 -->
<u-modal v-model="showLicense" title="申请协议">
<scroll-view class="pops-content" :scroll-y="true">
<text>{{ license }}</text>
</scroll-view>
</u-modal>
</view>
</template>
<script>
import * as ApplyApi from '@/api/dealer/apply'
import SettingModel from '@/common/model/dealer/Setting'
export default {
data() {
return {
// 正在加载
isLoading: true,
// 当前是否为分销商
isDealer: undefined,
// 当前是否在申请中
isApplying: undefined,
// 推荐人昵称
refereeName: undefined,
// 文字设置
words: undefined,
// 背景图
background: undefined,
// 入驻协议
license: undefined,
// 入驻协议阅读状态
isRead: false,
// 显示入驻协议弹窗
showLicense: false,
// 按钮禁用
disabled: false
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getSetting()
this.getApplyStatus()
},
methods: {
// 获取分销设置
getSetting() {
const app = this
SettingModel.data()
.then(setting => {
// 赋值属性
app.words = setting.words.apply.words
app.background = setting.background.apply
app.license = setting.license.license
// 设置当前页面标题
app.setPageTitle(setting.words.apply.title)
})
},
// 分销商申请状态
getApplyStatus() {
const app = this
app.isLoading = true
ApplyApi.status()
.then(result => {
const data = result.data
app.isDealer = data.isDealer
app.isApplying = data.isApplying
app.refereeName = data.refereeName
})
.finally(() => app.isLoading = false)
},
// 设置当前页面标题
setPageTitle(title) {
uni.setNavigationBarTitle({ title: title.value })
},
// 切换支付选项
handleChecked(value) {
this.payment = value
},
// 显示入驻协议弹窗
handleShowLicense() {
this.showLicense = true
},
// 表单提交
handleSubmit({ detail }) {
const app = this
// 表单验证
if (!app.onValidation(detail.value)) {
return false
}
// 确认提交
app.disabled = true
ApplyApi.submit({ form: detail.value })
.then(result => {
app.$toast(result.message)
setTimeout(() => uni.navigateBack(), 1200)
})
.finally(() => app.disabled = false)
},
// 表单验证
onValidation(data) {
const app = this
// 验证可提现佣金
if (!data.name) {
app.$error('请填写姓名')
return false
}
// 验证手机号
if (!/^\+?\d[\d -]{8,12}\d/.test(data.mobile)) {
app.$error('手机号格式不正确')
return false
}
// 验证是否阅读协议
if (!app.isRead) {
app.$error('请先阅读分销商申请协议')
return false
}
return true
},
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
.c-violet {
color: #786cff;
}
.col-80 {
color: #808080;
}
.col-bb {
color: #bbb;
}
.f-38 {
font-size: 38rpx;
}
.dealer-bg {
.image {
width: 100%;
}
}
.widget-form {
position: relative;
width: 700rpx;
box-sizing: border-box;
box-shadow: 0 1rpx 20rpx rgba(0, 0, 0, 0.21);
border-radius: 12rpx;
margin-top: -80rpx;
.form-title {
padding: 0 40rpx;
height: 90rpx;
border-bottom: 1rpx solid #e7e7e7;
display: flex;
align-items: center;
}
.form-box {
padding: 40rpx 35rpx;
.form-field {
height: 80rpx;
margin-bottom: 24rpx;
padding: 10rpx 28rpx;
background-color: #f9f9f9;
box-sizing: border-box;
font-size: 28rpx;
.field-label {
width: 130rpx;
color: #808080;
}
.input {
font-size: 28rpx;
}
}
}
}
.form-license {
.license-icon {
margin-right: 12rpx;
}
}
.form-submit {
margin-top: 40rpx;
button {
font-size: 30rpx;
background: #786cff;
border: 1rpx solid #786cff;
color: white;
border-radius: 50rpx;
padding: 0 120rpx;
&[disabled] {
background: #8e84fc;
border-color: #8e84fc;
color: white;
}
}
}
// 申请协议
.pops-content {
padding: 30rpx 48rpx;
font-size: 28rpx;
line-height: 50rpx;
text-align: left;
color: #606266;
min-height: 320rpx;
max-height: 640rpx;
box-sizing: border-box;
}
// 等待审核
.dealer-boot {
padding: 10rpx 30rpx;
margin-top: 80rpx;
.msg__icon {
font-size: 120rpx;
color: #8e84fc;
}
.boot__submit {
margin-top: 60rpx;
}
}
</style>

237
package/dealer/driver.vue Executable file
View File

@@ -0,0 +1,237 @@
<template>
<view class="container" v-if="!isLoading">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ use: false }" :up="upOption"
@up="upCallback">
<!-- 团队总人数 -->
<view class="widget-people f-28 col-9">
<text>司机列表({{total}})</text>
<u-button type="primary" size="mini">添加</u-button>
</view>
<!-- 列表数据 -->
<view class="widget-list b-f">
<view class="widget__detail dis-flex flex-x-between" v-for="(item, index) in list" :key="index">
<view class="detail__left dis-flex flex-y-center">
<avatar-image class="user-avatar" :url="item.user.avatar_url" :width="100" :borderWidth="4"
:borderColor="`#fff`" />
<view class="user-info dis-flex flex-dir-column flex-x-center">
<view class="user-nickName f-28">{{ item.real_name }}</view>
<view class="user-time col-9 f-24">{{ item.mobile }}</view>
</view>
</view>
<view class="detail__right dis-flex flex-dir-column flex-x-center flex-y-center">
<view class="detail__money">
</view>
<view class="detail__member f-22">
派单
</view>
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import AvatarImage from '@/components/avatar-image'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import * as Api from '@/api/shop/clerk'
import * as DealerApi from '@/api/dealer'
import SettingModel from '@/common/model/dealer/Setting'
const pageSize = 15
export default {
components: {
MescrollBody,
AvatarImage
},
mixins: [MescrollMixin],
data() {
return {
// 选项卡列表
tabList: [],
// 当前选项
curTab: 0,
// 列表数据
list: getEmptyPaginateObj(),
total: 0,
// 上拉加载配置
upOption: {
// 首次自动执行
auto: true,
// 每页数据的数量; 默认10
page: { size: pageSize },
// 数量要大于12条才显示无更多数据
noMoreSize: 12,
// 空布局
empty: {
tip: '亲,暂无相关数据'
}
},
// 正在加载
isLoading: true,
// 文字设置
words: undefined,
// 团队总人数
teamTotal: undefined,
orderId: 0
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const app = this
console.log(options.orderId);
app.orderId = options.orderId
app.isLoading = true
Promise.all([app.getSetting(), app.getDealerUser()])
.then(result => {
const setting = result[0]
const dealer = result[1]
// app.setTabList(setting, dealer)
})
.finally(() => app.isLoading = false)
},
methods: {
// 获取分销设置
getSetting() {
const app = this
return new Promise((resolve, reject) => {
SettingModel.data()
.then(setting => {
app.words = setting.words.team.words
resolve(setting)
})
.catch(reject)
})
},
// 获取分销用户信息
getDealerUser() {
const app = this
const { shopId } = uni.getStorageSync('shopInfo')
Api.list({shopId}).then((result) => {
app.list = result.data.list
app.total = result.data.total
})
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
upCallback(page) {
const app = this
// 设置列表数据
app.getList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
// 获取提现列表
getList(pageNo = 1) {
const app = this
return new Promise((resolve, reject) => {
Api.list({ level: app.getTabValue(), page: pageNo })
.then(result => {
// 合并新数据
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
resolve(newList)
})
})
},
// 获取当前标签项的值
getTabValue() {
const app = this
if (app.tabList.length) {
return app.tabList[app.curTab].value
}
return 1
},
// 切换标签项
onChangeTab(index) {
const app = this
// 设置当前选中的标签
app.curTab = index
// 刷新订单列表
app.onRefreshList()
},
// 刷新列表数据
onRefreshList() {
this.list = getEmptyPaginateObj()
setTimeout(() => {
this.mescroll.resetUpScroll()
}, 120)
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
// 团队人数
.widget-people {
padding: 0 25rpx;
height: 80rpx;
line-height: 60rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
background: #f7f7f7;
}
// 列表内容
.widget-list {
padding: 10rpx 20rpx 40rpx 20rpx;
box-sizing: border-box;
}
.widget__detail {
padding: 20rpx 15rpx;
box-sizing: border-box;
font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7;
.user-avatar {
margin-right: 16rpx;
}
.user-info {
height: 100%;
}
.user-nickName {
margin-bottom: 8rpx;
}
.detail__member {
background-color: #786cff;
color: #fff;
padding: 2rpx 15rpx;
border-radius: 6rpx;
margin-top: 10rpx;
}
}
</style>

321
package/dealer/index.vue Executable file
View File

@@ -0,0 +1,321 @@
<template>
<view v-if="!isLoading" class="container b-f">
<!-- 分销商中心 -->
<view class="center" v-if="isDealer">
<!-- 头部背景图 -->
<view class="dealer-bg">
<image class="image" mode="widthFix" :src="setting.background"></image>
</view>
<!-- 内容区 -->
<view class="widget-body b-f dis-flex flex-dir-column flex-y-center">
<!-- 用户信息 -->
<view class="widget widget__base m-top20 b-f dis-flex flex-dir-column">
<view class="base__user f-30">
<!-- 用户头像 -->
<avatar-image class="user-avatar" :url="shopInfo.logoUrl" :width="150" :borderWidth="4"
:borderColor="`#fff`" />
<view class="user-nickName f-32">{{ shopInfo.shopName }}</view>
<!-- <view class="user-referee f-24 col-9">
{{ setting.words.index.words.referee.value }}{{ refereeName }}
</view> -->
</view>
<view class="base__capital dis-flex flex-dir-column">
<!-- 佣金卡片 -->
<view class="capital-card dis-flex">
<view class="card-left">
<view class="f-28 col-f">
<text space="ensp">{{ setting.words.index.words.money.value }} {{ dealer.money }}</text>
<text class="m-l-10"></text>
</view>
<view class="f-28 col-f">
<text space="ensp">{{ setting.words.index.words.freeze_money.value }} {{ dealer.freeze_money }}</text>
<text class="m-l-10"></text>
</view>
</view>
<view class="card-right flex-box dis-flex flex-x-end flex-y-center">
<view class="withdraw-btn f-26" @click="$navTo('pages/dealer/withdraw/apply')">
{{ setting.words.index.words.withdraw.value }}
</view>
</view>
</view>
<!-- 已提现金额 -->
<view class="capital-already clear">
<view class="already-left f-26 fl">{{ setting.words.index.words.total_money.value }}</view>
<view class="already-right f-26 fr">{{ dealer.total_money }}</view>
</view>
</view>
</view>
<!-- 操作列表 -->
<view class="widget widget__operat clear b-f">
<view class="operat__item" @click="$navTo('pages/dealer/withdraw/list')">
<view class="item__icon">
<text class="iconfont icon-zhangben" style="color:#F9BA21;"></text>
</view>
<view class="item__text f-26">{{ setting.words.withdraw_list.title.value }}</view>
</view>
<view class="operat__item" @click="$navTo('pages/dealer/order')">
<view class="item__icon">
<text class="iconfont icon-dingdan" style="color:#FF7575;"></text>
</view>
<view class="item__text f-26">{{ setting.words.order.title.value }}</view>
</view>
<!-- <view class="operat__item" @click="$navTo('pages/dealer/team')">
<view class="item__icon">
<text class="iconfont icon-tuandui" style="color:#59C78E;"></text>
</view>
<view class="item__text f-26">{{ setting.words.team.title.value }}</view>
</view> -->
<view class="operat__item" @click="$navTo('pages/dealer/poster')">
<view class="item__icon">
<text class="iconfont icon-erweima" style="color:#5fa5ff;"></text>
</view>
<view class="item__text f-26">{{ setting.words.poster.title.value }}</view>
</view>
</view>
</view>
</view>
<!-- 当前不是分销商 -->
<view class="container b-f" v-if="!isDealer">
<view class="no-dealer">
<view class="no-icon dis-flex flex-x-center">
<image src="/static/not-dealer.png"></image>
</view>
<view class="no-msg dis-flex flex-x-center f-30">{{ setting.words.index.words.not_dealer.value }}
</view>
<!-- 立即申请 -->
<view class="no-submit form-submit">
<view class="button" @click="$navTo('pages/dealer/apply')">{{ setting.words.index.words.apply_now.value }}
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import AvatarImage from '@/components/avatar-image'
import * as Api from '@/api/dealer'
import * as UserApi from '@/api/user'
export default {
components: {
AvatarImage
},
data() {
return {
// 正在加载
isLoading: true,
// 当前商户信息
shopInfo: {},
// 当前是否为分销商
isDealer: false,
// 当前分销商信息
dealer: undefined,
// 推荐人昵称
refereeName: undefined,
// 分销设置
setting: {
background: undefined,
words: undefined
}
}
},
/**
* 生命周期函数--监听页面加载
*/
onShow(options) {
this.getCenter()
this.getUserInfo()
},
methods: {
// 获取当前用户信息
getUserInfo() {
const app = this
UserApi.info().then(result => {
app.shopInfo = result.data.shopInfo
})
},
// 获取分销商中心数据
getCenter() {
const app = this
app.isLoading = true
Api.center()
.then(result => {
// api数据赋值
const data = result.data
app.isDealer = data.isDealer
app.user = data.user
app.dealer = data.dealer
app.refereeName = data.refereeName
app.setting = data.setting
// 设置当前页面标题
app.setPageTitle()
app.isLoading = false
})
},
// 设置当前页面标题
setPageTitle() {
uni.setNavigationBarTitle({
// title: this.setting.words.index.title.value,
title: '我的商户'
})
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
.dealer-bg {
.image {
width: 100%;
}
}
.widget-body {
position: relative;
.widget {
width: 88%;
box-sizing: border-box;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.11);
border-radius: 12rpx;
}
}
.widget__base {
margin-top: -60rpx;
.base__user {
position: relative;
padding: 15rpx 40rpx;
border-bottom: 1rpx solid #e7e7e7;
.user-avatar {
position: absolute;
top: -75rpx;
right: 60rpx;
}
.user-nickName {
margin-top: 30rpx;
margin-bottom: 10rpx;
}
}
.base__capital {
padding: 35rpx;
.capital-card {
height: 200rpx;
padding: 36rpx 0;
background-color: #8e84fc;
border-radius: 10rpx;
box-sizing: border-box;
.card-left {
flex: 1;
display: flex;
justify-content: space-around;
align-items: flex-start;
flex-direction: column;
padding-left: 32rpx;
}
.card-right {
.withdraw-btn {
width: 130rpx;
height: 50rpx;
background: #fff;
color: #8e84fc;
border-radius: 24rpx;
margin-right: 32rpx;
display: flex;
justify-content: center;
align-items: center;
}
}
}
.capital-already {
padding: 20rpx;
padding-bottom: 0;
}
}
}
/* 操作列表 */
.widget__operat {
padding: 50rpx;
margin-top: 40rpx;
.operat__item {
width: 33.33333%;
float: left;
margin-bottom: 50rpx;
text-align: center;
&:last-child {
margin-bottom: 0;
}
.item__icon {
margin-bottom: 8rpx;
font-size: 58rpx;
}
}
}
/* 当前不是分销商 */
.no-dealer {
padding-top: 150rpx;
}
.no-icon {
image {
width: 420rpx;
height: 240rpx;
}
}
.no-msg {
padding: 86rpx 0;
}
.form-submit {
.button {
font-size: 30rpx;
background: #786cff;
border: 1rpx solid #786cff;
color: white;
border-radius: 50rpx;
padding: 22rpx 0;
width: 470rpx;
box-sizing: border-box;
margin: 0 auto;
text-align: center;
&.disabled {
opacity: 0.6;
}
}
}
</style>

223
package/dealer/order.vue Executable file
View File

@@ -0,0 +1,223 @@
<template>
<view class="container">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ use: false }" :up="upOption"
@up="upCallback">
<!-- tab栏 -->
<u-tabs :list="tabList" :is-scroll="false" :current="curTab" active-color="#786cff" :duration="0.2"
@change="onChangeTab" />
<!-- 列表数据 -->
<view class="widget-list b-f">
<view class="widget__detail" v-for="(item, index) in list.data" :key="index">
<view class="detail__row dis-flex flex-x-between">
<view class="detail__left f-24">订单号{{ item.order.order_no }}</view>
<view class="detail__right f-24 c-violet">
{{ item.order.state_text }}
</view>
</view>
<view class="detail__row m-top10 dis-flex flex-x-between">
<view class="detail__left dis-flex flex-y-center">
<avatar-image class="user-avatar" :url="item.user.avatar_url" :width="100" :borderWidth="4"
:borderColor="`#fff`" />
<view class="user-info dis-flex flex-dir-column flex-x-center">
<view class="user-nickName f-28">{{ item.user.nick_name }}</view>
<view class="user-time f-24 c-80">消费金额{{ item.order_price }}</view>
</view>
</view>
<view class="detail__right dis-flex flex-dir-column flex-x-center flex-y-center">
<view class="detail__money t-r col-m">
<text class="f-26">+ </text>
<text class="f-28">{{ item.my_money }}</text>
</view>
<view class="detail__time f-22 c-80">{{ item.create_time }}</view>
</view>
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import AvatarImage from '@/components/avatar-image'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import * as Api from '@/api/dealer/order'
import SettingModel from '@/common/model/dealer/Setting'
const pageSize = 15
export default {
components: {
MescrollBody,
AvatarImage
},
mixins: [MescrollMixin],
data() {
return {
// 选项卡列表
tabList: [],
// 当前选项
curTab: 0,
// 列表数据
list: getEmptyPaginateObj(),
// 上拉加载配置
upOption: {
// 首次自动执行
auto: true,
// 每页数据的数量; 默认10
page: { size: pageSize },
// 数量要大于12条才显示无更多数据
noMoreSize: 12,
// 空布局
empty: {
tip: '亲,暂无相关数据'
}
}
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getSetting()
},
methods: {
// 获取分销设置
getSetting() {
const app = this
SettingModel.data()
.then(setting => {
const words = setting.words.order
app.setPageTitle(words.title)
app.setTabList(words.words)
})
},
// 设置页面标题
setPageTitle(title) {
uni.setNavigationBarTitle({
title: title.value
})
},
// 设置选项卡数据
setTabList(words) {
const app = this
app.tabList = [
{ value: -1, name: words.all.value },
{ value: 0, name: words.unsettled.value },
{ value: 1, name: words.settled.value }
]
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
upCallback(page) {
const app = this
// 设置列表数据
app.getList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
// 获取提现列表
getList(pageNo = 1) {
const app = this
return new Promise((resolve, reject) => {
Api.list({ settled: app.getTabValue(), page: pageNo })
.then(result => {
// 合并新数据
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
resolve(newList)
})
})
},
// 获取当前标签项的值
getTabValue() {
const app = this
if (app.tabList.length) {
return app.tabList[app.curTab].value
}
return -1
},
// 切换标签项
onChangeTab(index) {
const app = this
// 设置当前选中的标签
app.curTab = index
// 刷新订单列表
app.onRefreshList()
},
// 刷新列表数据
onRefreshList() {
this.list = getEmptyPaginateObj()
setTimeout(() => {
this.mescroll.resetUpScroll()
}, 120)
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
.c-violet {
color: #786cff;
}
.c-80 {
color: #808080;
}
// 订单列表
.widget-list {
padding: 10rpx 20rpx 40rpx 20rpx;
box-sizing: border-box;
}
.widget__detail {
padding: 20rpx 15rpx;
box-sizing: border-box;
font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7;
.user-avatar {
margin-right: 16rpx;
}
.user-info {
height: 100%;
.user-nickName {
margin-bottom: 8rpx;
}
}
.detail__money {
width: 100%;
margin-bottom: 8rpx;
}
}
</style>

80
package/dealer/poster.vue Executable file
View File

@@ -0,0 +1,80 @@
<template>
<view class="container">
<view v-if="imageUrl" class="poster">
<image class="image" mode="widthFix" :src="imageUrl" @click="onPreviewImage"></image>
</view>
</view>
</template>
<script>
import * as Api from '@/api/dealer/poster'
import SettingModel from '@/common/model/dealer/Setting'
export default {
data() {
return {
// 海报图url
imageUrl: undefined
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getSetting()
this.getPoster()
},
methods: {
// 获取分销设置
getSetting() {
const app = this
SettingModel.data()
.then(setting => {
const words = setting.words.poster
app.setPageTitle(words.title)
})
},
// 获取推广二维码
getPoster() {
const app = this
app.isLoading = true
Api.qrcode({ channel: app.platform })
.then(result => {
// api数据赋值
app.imageUrl = result.data.imageUrl
})
.finally(() => app.isLoading = false)
},
// 设置当前页面标题
setPageTitle(title) {
uni.setNavigationBarTitle({ title: title.value })
},
// 预览海报图
onPreviewImage() {
uni.previewImage({
current: this.imageUrl,
urls: [this.imageUrl]
})
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
.poster .image {
display: block;
width: 100%;
}
</style>

236
package/dealer/team.vue Executable file
View File

@@ -0,0 +1,236 @@
<template>
<view class="container" v-if="!isLoading">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ use: false }" :up="upOption"
@up="upCallback">
<!-- 团队总人数 -->
<view class="widget-people f-28 col-9">
<text>司机列表({{total}})</text>
<!-- <u-button type="primary" size="mini">添加</u-button> -->
</view>
<!-- 列表数据 -->
<view class="widget-list b-f">
<view class="widget__detail dis-flex flex-x-between" v-for="(item, index) in list" :key="index">
<view class="detail__left dis-flex flex-y-center">
<avatar-image class="user-avatar" :url="item.user.avatar_url" :width="100" :borderWidth="4"
:borderColor="`#fff`" />
<view class="user-info dis-flex flex-dir-column flex-x-center">
<view class="user-nickName f-28">{{ item.real_name }}</view>
<view class="user-time col-9 f-24">{{ item.mobile }}</view>
</view>
</view>
<!-- <view class="detail__right dis-flex flex-dir-column flex-x-center flex-y-center">
<view class="detail__money">
<text class="f-24"></text>
<text class="f-34">{{ item.user.expend_money }}</text>
</view>
<view class="detail__member f-22" v-if="item.subDealer">
{{ item.subDealer.first_num + item.subDealer.second_num + item.subDealer.third_num }}个成员
</view>
</view> -->
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import AvatarImage from '@/components/avatar-image'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import * as Api from '@/api/shop/clerk'
import * as DealerApi from '@/api/dealer'
import SettingModel from '@/common/model/dealer/Setting'
const pageSize = 15
export default {
components: {
MescrollBody,
AvatarImage
},
mixins: [MescrollMixin],
data() {
return {
// 选项卡列表
tabList: [],
// 当前选项
curTab: 0,
// 列表数据
list: getEmptyPaginateObj(),
total: 0,
// 上拉加载配置
upOption: {
// 首次自动执行
auto: true,
// 每页数据的数量; 默认10
page: { size: pageSize },
// 数量要大于12条才显示无更多数据
noMoreSize: 12,
// 空布局
empty: {
tip: '亲,暂无相关数据'
}
},
// 正在加载
isLoading: true,
// 文字设置
words: undefined,
// 团队总人数
teamTotal: undefined
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const app = this
app.isLoading = true
Promise.all([app.getSetting(), app.getDealerUser()])
.then(result => {
const setting = result[0]
const dealer = result[1]
// app.setTabList(setting, dealer)
})
.finally(() => app.isLoading = false)
},
methods: {
// 获取分销设置
getSetting() {
const app = this
return new Promise((resolve, reject) => {
SettingModel.data()
.then(setting => {
app.words = setting.words.team.words
resolve(setting)
})
.catch(reject)
})
},
// 获取分销用户信息
getDealerUser() {
const app = this
const { shopId } = uni.getStorageSync('shopInfo')
Api.list({shopId}).then((result) => {
app.list = result.data.list
app.total = result.data.total
})
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
upCallback(page) {
const app = this
// 设置列表数据
app.getList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
// 获取提现列表
getList(pageNo = 1) {
const app = this
return new Promise((resolve, reject) => {
Api.list({ level: app.getTabValue(), page: pageNo })
.then(result => {
// 合并新数据
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
resolve(newList)
})
})
},
// 获取当前标签项的值
getTabValue() {
const app = this
if (app.tabList.length) {
return app.tabList[app.curTab].value
}
return 1
},
// 切换标签项
onChangeTab(index) {
const app = this
// 设置当前选中的标签
app.curTab = index
// 刷新订单列表
app.onRefreshList()
},
// 刷新列表数据
onRefreshList() {
this.list = getEmptyPaginateObj()
setTimeout(() => {
this.mescroll.resetUpScroll()
}, 120)
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
// 团队人数
.widget-people {
padding: 0 25rpx;
height: 80rpx;
line-height: 60rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
background: #f7f7f7;
}
// 列表内容
.widget-list {
padding: 10rpx 20rpx 40rpx 20rpx;
box-sizing: border-box;
}
.widget__detail {
padding: 20rpx 15rpx;
box-sizing: border-box;
font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7;
.user-avatar {
margin-right: 16rpx;
}
.user-info {
height: 100%;
}
.user-nickName {
margin-bottom: 8rpx;
}
.detail__member {
background-color: #786cff;
color: #fff;
padding: 2rpx 15rpx;
border-radius: 6rpx;
margin-top: 10rpx;
}
}
</style>

398
package/dealer/withdraw/apply.vue Executable file
View File

@@ -0,0 +1,398 @@
<template>
<view v-if="!isLoading" class="container b-f">
<!-- 头部背景图 -->
<view class="dealer-bg">
<image class="image" mode="widthFix" :src="background"></image>
</view>
<view class="widget-body">
<form @submit="handleSubmit">
<!-- 提现佣金 -->
<view class="widget widget__capital m-top20 b-f dis-flex flex-dir-column">
<view class="capital__item dis-flex flex-x-between flex-y-center">
<view class="item__left">{{ words.capital.value }}</view>
<view class="item__right c-violet">
<text class="f-24"></text>
<text class="f-34">{{ shopInfo.money }}</text>
</view>
</view>
<view class="capital__item dis-flex flex-y-center">
<view class="item__left">{{ words.money.value }}</view>
<view class="item__right flex-box">
<input class="input" name="money" :placeholder="words.money_placeholder.value"></input>
</view>
</view>
</view>
<!-- 最低提现金额 -->
<!-- <view class="capital__lowest m-top20 col-7 t-r">
{{ words.min_money.value }}{{ settlement.min_money }}
</view> -->
<view class="capital__lowest m-top20 col-7 t-r">
<u-button size="mini" @click="navTo('package/dealer/withdraw/list')">查看明细</u-button>
<text>提现手续费3%</text>
</view>
<!-- 提现方式 -->
<view class="widget widget__form m-top20 b-f dis-flex flex-dir-column">
<view class="form__title f-28">提现方式</view>
<view class="form__box">
<block v-for="(item, index) in settlement.pay_type" :key="index">
<block v-if="item == PayTypeEnum.WECHAT.value">
<!-- 微信支付 -->
<!-- <view class="form__field dis-flex flex-y-center">
<view class="form__radio dis-flex flex-y-center"
@click="handleChecked(PayTypeEnum.WECHAT.value)">
<text class="radio__icon iconfont icon-radio"
:class="[payment == PayTypeEnum.WECHAT.value ? 'c-violet' : 'col-bb']"></text>
<text class="f-28">{{ PayTypeEnum.WECHAT.name }}</text>
</view>
</view> -->
</block>
<block v-if="item == PayTypeEnum.ALIPAY.value">
<!-- 支付宝 -->
<view class="form__field dis-flex flex-y-center">
<view class="form__radio dis-flex flex-y-center"
@click="handleChecked(PayTypeEnum.ALIPAY.value)">
<text class="radio__icon iconfont icon-radio"
:class="[payment == PayTypeEnum.ALIPAY.value ? 'c-violet' : 'col-bb']"></text>
<text class="f-28">{{ PayTypeEnum.ALIPAY.name }}</text>
</view>
</view>
<block v-if="payment == PayTypeEnum.ALIPAY.value">
<u-alert-tips v-if="!shopInfo.alipayAccount" type="warning" :title="title"
:description="'首次提现将会保存,请填写正确的支付宝账号!'"></u-alert-tips>
<view class="form__field dis-flex flex-y-center">
<view class="field-input flex-box">
<input class="input" name="alipay_name" :value="shopInfo.alipayName"
:disabled="shopInfo.alipayName" placeholder="请输入真实姓名"></input>
</view>
</view>
<view class="form__field dis-flex flex-y-center">
<view class="field-input flex-box">
<input class="input" name="alipay_account" :value="shopInfo.alipayAccount"
:disabled="shopInfo.alipayAccount" placeholder="请输入支付宝账号"></input>
</view>
</view>
</block>
</block>
<block v-if="item == PayTypeEnum.BANK_CARD.value">
<!-- 银行卡 -->
<view class="form__field dis-flex flex-y-center">
<view class="form__radio dis-flex flex-y-center"
@click="handleChecked(PayTypeEnum.BANK_CARD.value)">
<text class="radio__icon iconfont icon-radio"
:class="[payment == PayTypeEnum.BANK_CARD.value ? 'c-violet' : 'col-bb']"></text>
<text class="f-28">{{ PayTypeEnum.BANK_CARD.name }}</text>
</view>
</view>
<block v-if="payment == PayTypeEnum.BANK_CARD.value">
<view class="form__field dis-flex flex-y-center">
<view class="field-input flex-box">
<input class="input" name="bank_name" placeholder="请输入真实姓名"></input>
</view>
</view>
<view class="form__field dis-flex flex-y-center">
<view class="field-input flex-box">
<input class="input" name="bank_account" placeholder="请输入开户行名称/地址"></input>
</view>
</view>
<view class="form__field dis-flex flex-y-center">
<view class="field-input flex-box">
<input class="input" name="bank_card" placeholder="请输入银行卡号"></input>
</view>
</view>
</block>
</block>
</block>
</view>
</view>
<!-- 提交申请 -->
<view class="form-submit dis-flex flex-x-center">
<button formType="submit" :disabled="disabled">{{ words.submit.value }}</button>
</view>
</form>
</view>
</view>
</template>
<script>
import * as DealerApi from '@/api/dealer'
import * as ShopApi from '@/api/shop.js'
import * as WithdrawApi from '@/api/dealer/withdraw'
import SettingModel from '@/common/model/dealer/Setting'
import {
PayTypeEnum
} from '@/common/enum/dealer/withdraw'
export default {
data() {
return {
// 枚举类
PayTypeEnum,
// 正在加载
isLoading: true,
shopInfo: {},
shopId: 0,
// 分销商用户信息
dealer: undefined,
// 当前提现方式(选中的)
payment: undefined,
// 分销结算设置
settlement: undefined,
// 文字设置
words: undefined,
// 背景图
background: undefined,
// 按钮禁用
disabled: false
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getSetting()
this.getDealer()
this.getShopInfo()
},
methods: {
navTo(url) {
this.$navTo(url)
},
getShopInfo() {
const shopInfo = uni.getStorageSync('shopInfo')
const {
shopId
} = shopInfo
this.shopId = shopId
ShopApi.detail(shopId).then(res => {
this.shopInfo = res.data.detail
})
},
// 获取分销设置
getSetting() {
const app = this
SettingModel.data()
.then(setting => {
// 赋值属性
app.payment = setting.settlement.pay_type[0]
app.settlement = setting.settlement
app.words = setting.words.withdraw_apply.words
app.background = setting.background.withdraw_apply
// 设置当前页面标题
app.setPageTitle(setting.words.withdraw_apply.title)
})
},
// 获取分销商
getDealer() {
const app = this
app.isLoading = true
DealerApi.user()
.then(result => app.dealer = result.data.dealer)
.finally(() => app.isLoading = false)
},
// 设置当前页面标题
setPageTitle(title) {
uni.setNavigationBarTitle({
title: title.value
})
},
// 切换支付选项
handleChecked(value) {
this.payment = value
},
// 表单提交
handleSubmit({
detail
}) {
const app = this
// 表单验证
if (!app.onValidation(detail.value)) {
return false
}
// 确认是否提交
uni.showModal({
title: '友情提示',
content: '确定提交提现申请吗?请确认填写无误',
showCancel: true,
success(res) {
if (res.confirm) {
app.onSubmit(detail.value)
} else if (res.cancel) {
app.disabled = false
}
}
})
},
// 提交提现申请
onSubmit(data) {
const app = this
app.disabled = true
data.pay_type = app.payment
data.shopId = app.shopId
ShopApi.submit({
form: data
})
.then(result => {
app.$toast(result.message)
setTimeout(() => uni.navigateBack(), 1200)
})
.finally(() => app.disabled = false)
},
// 表单验证
onValidation(data) {
const app = this
const words = app.words
// 验证可提现佣金
if (app.dealer.money <= 0) {
app.$error('当前没有' + words.capital.value)
return false
}
// 验证提现金额
if (!data.money || data.money.length < 1) {
app.$error('请填写' + words.money.value)
return false
}
return true
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
.c-violet {
color: #786cff;
}
.col-bb {
color: #bbb;
}
.dealer-bg {
.image {
width: 100%;
}
}
.widget-body {
position: relative;
width: 88%;
margin: 0 auto;
.widget {
box-sizing: border-box;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.11);
border-radius: 12rpx;
}
}
// 提现金额
.widget__capital {
padding: 10rpx 0;
margin-top: -60rpx;
.capital__item {
height: 80rpx;
padding: 10rpx 35rpx;
font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7;
box-sizing: border-box;
&:last-child {
border-bottom: none;
}
.item__left {
margin-right: 20rpx;
}
.item__right {
.input {
font-size: 28rpx;
text-align: right;
}
}
}
}
.capital__lowest {
padding-right: 20rpx;
box-sizing: border-box;
font-size: 26rpx;
display: flex;
justify-content: space-between;
}
// 提现方式
.widget__form {
padding: 10rpx 0 20rpx 0;
.form__title {
padding: 16rpx 35rpx;
border-bottom: 1rpx solid #f3f3f3;
}
.form__box {
padding: 20rpx 35rpx;
}
.form__field {
height: 80rpx;
padding: 0;
box-sizing: border-box;
font-size: 28rpx;
margin-bottom: 10rpx;
.radio__icon {
font-size: 38rpx;
margin-right: 12rpx;
}
.field-input {
.input {
background-color: #f9f9f9;
// height: 70rpx;
padding: 16rpx 20rpx;
font-size: 28rpx;
}
}
}
}
// 提交申请
.form-submit {
margin-top: 40rpx;
button {
font-size: 30rpx;
background: #786cff;
border: 1rpx solid #786cff;
color: white;
border-radius: 50rpx;
padding: 0 120rpx;
}
button[disabled] {
background: #8e84fc;
border-color: #8e84fc;
color: white;
}
}
</style>

249
package/dealer/withdraw/list.vue Executable file
View File

@@ -0,0 +1,249 @@
<template>
<view class="container">
<mescroll-body ref="mescrollRef" :sticky="true" @init="mescrollInit" :down="{ use: false }" :up="upOption"
@up="upCallback">
<!-- tab栏 -->
<u-tabs :list="tabList" :is-scroll="false" :current="curTab" active-color="#786cff" :duration="0.2"
@change="onChangeTab" />
<!-- 列表数据 -->
<view class="widget-list">
<view class="widget__detail dis-flex flex-x-between" v-for="(item, index) in list.data" :key="index">
<view class="detail__left dis-flex flex-dir-column flex-x-around">
<view class="detail__money f-30">
<text>提现 {{ item.money }}</text>
<text v-if="item.pay_type == 10" class="iconfont icon-weixin"></text>
<text v-if="item.pay_type == 20" class="iconfont icon-alipay"></text>
<text v-if="item.pay_type == 30" class="iconfont icon-weixin"></text>
</view>
<view class="detail__time col-9 f-24">{{ item.create_time }}</view>
</view>
<view class="detail__right dis-flex flex-dir-column flex-x-center flex-y-center">
<view class="detail__status f-28" :class="[ApplyStatusColor[item.apply_status]]">
<text v-if="item.apply_status == 10">待审核</text>
<text v-if="item.apply_status == 20">审核通过</text>
<text v-if="item.apply_status == 30">驳回</text>
<text v-if="item.apply_status == 40">已打款</text>
</view>
<block v-if="item.apply_status == 30">
<view class="detail__reason f-24" @click="triggerReasonMsg">查看原因
</view>
<u-modal v-model="showReasonMsg" title="驳回原因">
<view class="show-reason-msg">{{ item.reject_reason }}</view>
</u-modal>
</block>
</view>
</view>
</view>
</mescroll-body>
</view>
</template>
<script>
import MescrollBody from '@/components/mescroll-uni/mescroll-body.vue'
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins'
import { getEmptyPaginateObj, getMoreListData } from '@/core/app'
import * as Api from '@/api/shop/withdraw'
import SettingModel from '@/common/model/dealer/Setting'
import { ApplyStatusEnum } from '@/common/enum/dealer/withdraw'
const pageSize = 15
// 提现状态文字
const ApplyStatusText = [10,20,30]
// 提现状态颜色
const ApplyStatusColor = {
[ApplyStatusEnum.WAIT.value]: 'col-m',
[ApplyStatusEnum.PASSED.value]: 'col-green',
[ApplyStatusEnum.REJECT.value]: 'col-m',
[ApplyStatusEnum.PAYMENT.value]: 'col-green'
}
export default {
components: {
MescrollBody
},
mixins: [MescrollMixin],
data() {
return {
// 枚举类
ApplyStatusEnum,
ApplyStatusColor,
ApplyStatusText,
// 选项卡列表
tabList: [],
// 当前选项
curTab: 0,
// 列表数据
list: getEmptyPaginateObj(),
shopId: 0,
showReasonMsg: false,
// 上拉加载配置
upOption: {
// 首次自动执行
auto: true,
// 每页数据的数量; 默认10
page: { size: pageSize },
// 数量要大于12条才显示无更多数据
noMoreSize: 12,
// 空布局
empty: {
tip: '亲,暂无相关数据'
}
}
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
this.getSetting()
},
methods: {
// 获取分销设置
getSetting() {
const app = this
SettingModel.data()
.then(setting => {
const words = setting.words.withdraw_list
app.setPageTitle(words.title)
app.setTabList(words.words)
})
},
// 设置页面标题
setPageTitle(title) {
uni.setNavigationBarTitle({
title: title.value
})
},
// 设置选项卡数据
setTabList(words) {
const app = this
app.tabList = [
{ value: -1, name: words.all.value },
{ value: ApplyStatusEnum.WAIT.value, name: words.apply_10.value },
{ value: ApplyStatusEnum.PASSED.value, name: words.apply_20.value },
{ value: ApplyStatusEnum.PAYMENT.value, name: words.apply_40.value },
{ value: ApplyStatusEnum.REJECT.value, name: words.apply_30.value }
]
},
triggerReasonMsg(){
this.showReasonMsg = !this.showReasonMsg
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
* @param {Object} page
*/
upCallback(page) {
const app = this
// 设置列表数据
app.getList(page.num)
.then(list => {
const curPageLen = list.data.length
const totalSize = list.data.total
app.mescroll.endBySize(curPageLen, totalSize)
})
.catch(() => app.mescroll.endErr())
},
// 获取提现列表
getList(pageNo = 1) {
const app = this
const { shopId } = uni.getStorageSync('shopInfo')
return new Promise((resolve, reject) => {
Api.list({ applyStatus: app.getTabValue(), page: pageNo, shopId })
.then(result => {
// 合并新数据
const newList = result.data.list
app.list.data = getMoreListData(newList, app.list, pageNo)
resolve(newList)
})
})
},
// 获取当前标签项的值
getTabValue() {
const app = this
if (app.tabList.length) {
return app.tabList[app.curTab].value
}
return -1
},
// 切换标签项
onChangeTab(index) {
const app = this
// 设置当前选中的标签
app.curTab = index
// 刷新订单列表
app.onRefreshList()
},
// 刷新列表数据
onRefreshList() {
this.list = getEmptyPaginateObj()
setTimeout(() => {
this.mescroll.resetUpScroll()
}, 120)
}
}
}
</script>
<style>
page {
background: #fff;
}
</style>
<style lang="scss" scoped>
// 提现明细列表
.widget-list {
padding: 10rpx 20rpx 40rpx 20rpx;
box-sizing: border-box;
}
.widget__detail {
padding: 20rpx 15rpx;
box-sizing: border-box;
font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7;
}
.widget__detail .detail__money {
font-size: 30rpx;
margin-bottom: 12rpx;
}
.widget__detail .detail__reason {
margin-top: 15rpx;
color: #8e84fc;
}
.show-reason-msg{
padding: 20rpx;
line-height: 2rem;
color: #ff0000;
}
.detail__left{
.iconfont{
margin-left: 30rpx;
font-size: 24rpx;
}
.icon-weixin{
color: #0eaf00;
}
.icon-alipay{
color: #0f80ff;
}
}
</style>