发布v1.0.3

This commit is contained in:
kele
2022-11-22 15:45:36 +08:00
commit 01f091fcd8
525 changed files with 80922 additions and 0 deletions
+237
View File
@@ -0,0 +1,237 @@
<template>
<su-popup :show="show" class="add-bank-wrap" @close="hideModal">
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left">
<text v-if="props.modelValue.type === 'bank'" class="modal-title ss-m-b-20">
绑定银行卡
</text>
<text v-if="props.modelValue.type === 'wechat'" class="modal-title ss-m-b-20">
绑定微信
</text>
<text v-if="props.modelValue.type === 'alipay'" class="modal-title ss-m-b-20">
绑定支付宝
</text>
</view>
<view class="modal-content ss-flex-1 ss-p-b-100">
<block v-if="props.modelValue.type === 'bank'">
<uni-forms
ref="form"
:model="state.bank.model"
:rules="state.bank.rules"
validateTrigger="bind"
labelWidth="160"
labelAlign="center"
border
:labelStyle="{ fontWeight: 'bold' }"
>
<uni-forms-item name="account_name" label="持卡人">
<uni-easyinput
:inputBorder="false"
placeholder="请输入持卡人"
v-model="state.bank.model.account_name"
/>
</uni-forms-item>
<uni-forms-item name="account_header" label="开户行">
<uni-easyinput
:inputBorder="false"
placeholder="请输入开户行"
v-model="state.bank.model.account_header"
/>
</uni-forms-item>
<uni-forms-item name="account_no" label="银行卡号">
<uni-easyinput
type="number"
:inputBorder="false"
placeholder="请输入银行卡号"
v-model="state.bank.model.account_no"
/>
</uni-forms-item>
</uni-forms>
</block>
<block v-if="props.modelValue.type === 'wechat'">
<uni-forms
ref="form"
:model="state.wechat.model"
:rules="state.wechat.rules"
validateTrigger="bind"
labelWidth="160"
labelAlign="center"
border
:labelStyle="{ fontWeight: 'bold' }"
>
<uni-forms-item name="account_name" label="真实姓名">
<uni-easyinput
:inputBorder="false"
placeholder="请输入您的真实姓名"
v-model="state.wechat.model.account_name"
/>
</uni-forms-item>
</uni-forms>
</block>
<block v-if="props.modelValue.type === 'alipay'">
<uni-forms
ref="form"
:model="state.alipay.model"
:rules="state.alipay.rules"
validateTrigger="bind"
labelWidth="160"
labelAlign="center"
border
:labelStyle="{ fontWeight: 'bold' }"
>
<uni-forms-item name="account_name" label="真实姓名">
<uni-easyinput
:inputBorder="false"
placeholder="请输入您的真实姓名"
v-model="state.alipay.model.account_name"
/>
</uni-forms-item>
<uni-forms-item name="account_no" label="支付宝">
<uni-easyinput
:inputBorder="false"
placeholder="请输入支付宝 邮箱/手机号"
v-model="state.alipay.model.account_no"
/>
</uni-forms-item>
</uni-forms>
</block>
</view>
<view class="modal-footer ss-flex ss-row-center ss-col-center">
<button class="ss-reset-button save-btn" @tap="onSave">保存</button>
</view>
</view>
</su-popup>
</template>
<script setup>
import { ref, reactive, unref, watchPostEffect, watch } from 'vue';
import sheep from '@/sheep';
import { realName, bankName, bankCode, alipayAccount } from '@/sheep/validate/form';
const form = ref(null);
const props = defineProps({
modelValue: {
type: Object,
default() {},
},
show: {
type: Boolean,
default: false,
},
});
watch(
() => props.modelValue,
(newValue, oldValue) => {
setModelValue(newValue);
},
);
function setModelValue(modelValue) {
Object.keys(state[modelValue.type].model).forEach((key) => {
state[modelValue.type].model[key] = modelValue[key];
});
}
const emits = defineEmits(['update:modelValue', 'close']);
// 数据
const state = reactive({
bank: {
model: {
account_name: '',
account_header: '',
account_no: '',
},
rules: {
account_name: realName,
account_header: bankName,
account_no: bankCode,
},
},
alipay: {
model: {
account_name: '',
account_no: '',
},
rules: {
account_name: realName,
account_no: alipayAccount,
},
},
wechat: {
model: {
account_name: '',
},
rules: {
account_name: realName,
},
},
});
setModelValue(props.modelValue);
const hideModal = () => {
emits('close');
};
const onSave = async () => {
const validate = await unref(form)
.validate()
.catch((error) => {
'error: ', error;
});
if (!validate) return;
let data = {
type: props.modelValue.type,
account_header: state[props.modelValue.type].model.account_header,
account_name: state[props.modelValue.type].model.account_name,
account_no: state[props.modelValue.type].model.account_no,
};
let res = await sheep.$api.user.account.save(data);
if (res.error === 0) {
emits('update:modelValue', res.data);
hideModal();
}
};
</script>
<style lang="scss" scoped>
.ss-modal-box {
border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx;
.modal-header {
position: relative;
padding: 60rpx 40rpx 40rpx;
.modal-title {
font-size: 32rpx;
font-weight: bold;
}
.close-icon {
position: absolute;
top: 10rpx;
right: 20rpx;
font-size: 46rpx;
opacity: 0.2;
}
}
.modal-content {
overflow-y: auto;
}
.modal-footer {
height: 120rpx;
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
}
}
</style>
@@ -0,0 +1,186 @@
<template>
<su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal">
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left">
<text class="modal-title ss-m-b-20">选择提现方式</text>
</view>
<view class="modal-content ss-flex-1 ss-p-b-100">
<view
class="container-list ss-p-l-34 ss-p-r-24 ss-flex ss-col-center ss-row-center"
v-for="(item, index) in typeList"
:key="index"
>
<view class="container-icon ss-flex ss-m-r-20">
<image :src="sheep.$url.static(item.icon)" />
</view>
<view class="ss-flex-1">{{ item.title }}</view>
<view class="radio">
<radio-group @change="onChange">
<label class="radio">
<radio
:value="item.value"
color="var(--ui-BG-Main)"
:checked="item.value === state.currentValue"
:disabled="!methods.includes(item.value)"
/>
</label>
</radio-group>
</view>
</view>
</view>
<view class="modal-footer ss-flex ss-row-center ss-col-center">
<button class="ss-reset-button save-btn" @tap="onConfirm">确定</button>
</view>
</view>
</su-popup>
</template>
<script setup>
import { reactive, onBeforeMount, nextTick } from 'vue';
import sheep from '@/sheep';
const props = defineProps({
modelValue: {
type: Object,
default() {},
},
show: {
type: Boolean,
default: false,
},
methods: {
type: Array,
default: [],
},
});
const emits = defineEmits(['update:modelValue', 'change', 'close']);
const state = reactive({
currentValue: '',
});
const typeList = [
{
icon: '/static/img/shop/pay/wx_type.png',
title: '微信零钱',
value: 'wechat',
},
{
icon: '/static/img/shop/pay/ali_type.png',
title: '支付宝账户',
value: 'alipay',
},
{
icon: '/static/img/shop/pay/bank_type.png',
title: '银行卡转账',
value: 'bank',
},
];
const getWalletAccountInfo = async () => {
return new Promise(async (resolve, reject) => {
let res = await sheep.$api.user.account.info({
type: state.currentValue,
});
if (res.error === 0) {
if (!props.methods.includes(res.data.type)) {
return;
}
state.currentValue = res.data.type;
emits('update:modelValue', {
type: res.data.type,
account_header: res.data.account_header,
account_name: res.data.account_name,
account_no: res.data.account_no,
});
} else {
emits('update:modelValue', {
type: state.currentValue,
});
}
resolve();
});
};
function onChange(e) {
state.currentValue = e.detail.value;
}
const onConfirm = async () => {
if (state.currentValue === '') {
sheep.$helper.toast('请选择提现方式');
return;
}
await getWalletAccountInfo();
emits('close');
};
const hideModal = () => {
emits('close');
};
onBeforeMount(async () => {
await getWalletAccountInfo();
});
</script>
<style lang="scss" scoped>
.ss-modal-box {
border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx;
.modal-header {
position: relative;
padding: 60rpx 40rpx 40rpx;
.modal-title {
font-size: 32rpx;
font-weight: bold;
}
.close-icon {
position: absolute;
top: 10rpx;
right: 20rpx;
font-size: 46rpx;
opacity: 0.2;
}
}
.modal-content {
overflow-y: auto;
.container-list {
height: 96rpx;
border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
font-size: 28rpx;
font-weight: 500;
color: #333333;
.container-icon {
width: 36rpx;
height: 36rpx;
}
}
}
.modal-footer {
height: 120rpx;
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
}
}
image {
width: 100%;
height: 100%;
}
:deep(.uni-radio-input) {
width: 36rpx;
height: 36rpx;
}
</style>
+112
View File
@@ -0,0 +1,112 @@
<template>
<ui-modal
class="add-bank-wrap"
name="walletAddAlipay"
mask="40"
align="bottom"
ui="ss-r-t-30"
:showCancel="false"
:option="false"
>
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left">
<text class="cicon-close-round close-icon" @tap="hideModal"></text>
<text class="modal-title ss-m-b-20">添加支付宝</text>
</view>
<view class="modal-content ss-flex-1 ss-p-b-100">
<ui-form
ref="addAlipayFormRef"
:model="state.model"
:rules="state.rules"
hasClear
labelPosition="left"
:labelStyle="{ fontWeight: 'bold' }"
>
<ui-form-item prop="real_name" title="真实姓名">
<ui-input placeholder="请输入真实姓名" v-model="state.model.real_name"></ui-input>
</ui-form-item>
<ui-form-item prop="card_no" title="支付宝账号">
<ui-input placeholder="请输入支付宝账号" v-model="state.model.card_no"></ui-input>
</ui-form-item>
</ui-form>
</view>
<view class="modal-footer ss-flex ss-row-center ss-col-center">
<button class="ss-reset-button save-btn" @tap="onSave">确定</button>
</view>
</view>
</ui-modal>
</template>
<script setup>
import { ref, reactive, unref } from 'vue';
import { realName, bankCode } from '@/sheep/common/validate/form';
// 数据
const addAlipayFormRef = ref(null);
const state = reactive({
model: {
real_name: '',
card_no: '',
},
rules: {
real_name: realName,
card_no: bankCode,
},
});
const showModal = () => {
hooksModal.showModal('walletAddAlipay');
};
const hideModal = () => {
hooksModal.hideModal();
};
const onSave = async () => {
const res = await unref(addAlipayFormRef).validate();
};
defineExpose({
showModal,
});
</script>
<style lang="scss" scoped>
.ss-modal-box {
border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx;
.modal-header {
position: relative;
padding: 60rpx 40rpx 40rpx;
.modal-title {
font-size: 32rpx;
font-weight: bold;
}
.close-icon {
position: absolute;
top: 10rpx;
right: 20rpx;
font-size: 46rpx;
opacity: 0.2;
}
}
.modal-content {
overflow-y: auto;
}
.modal-footer {
height: 120rpx;
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
}
}
</style>
@@ -0,0 +1,94 @@
<!-- 提现方式 -->
<template>
<ui-modal
class="ss-checkout-counter-wrap"
name="walletTransfterBalance"
mask="40"
align="bottom"
ui="ss-r-t-30"
:showCancel="false"
:option="false"
>
<view class="ss-modal-box bg-white ss-flex-col">
<view class="modal-header ss-flex-col ss-col-left">
<text class="cicon-close-round close-icon" @tap="hideModal"></text>
<text class="modal-title ss-m-b-20">转余额</text>
<text class="modal-subtitle">将您的佣金转到钱包中继续消费</text>
</view>
<view class="modal-content ss-flex-1">
<view class="input-box ss-flex ss-col-center border-bottom">
<view calss="unit"></view>
<ui-input class="ss-flex-1 ss-p-l-10" type="number" placeholder="请输入金额" />
</view>
</view>
<view class="modal-footer ss-flex ss-row-center ss-col-center">
<button class="ss-reset-button save-btn" @tap="hideModal">确定</button>
</view>
</view>
</ui-modal>
</template>
<script setup>
/**
* 转余额弹窗
*/
</script>
<style lang="scss" scoped>
.ss-modal-box {
border-radius: 30rpx 30rpx 0 0;
max-height: 1000rpx;
.modal-header {
position: relative;
padding: 60rpx 40rpx 40rpx;
.modal-title {
font-size: 32rpx;
font-weight: bold;
}
.modal-subtitle {
font-size: 26rpx;
font-weight: 400;
color: $gray-d;
}
.close-icon {
position: absolute;
top: 10rpx;
right: 20rpx;
font-size: 46rpx;
opacity: 0.2;
}
}
.modal-content {
overflow-y: auto;
padding: 40rpx;
.input-box {
width: 624rpx;
height: 100rpx;
margin-bottom: 40rpx;
.unit {
font-size: 48rpx;
color: #333;
}
}
}
.modal-footer {
height: 120rpx;
.save-btn {
width: 710rpx;
height: 80rpx;
border-radius: 40rpx;
background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
color: $white;
}
}
}
</style>