Ver código fonte

✨ 分销提现:基本接入 50%

YunaiV 1 ano atrás
pai
commit
bc6ac22ce2

+ 1 - 1
pages/pay/components/account-info-modal.vue

@@ -106,7 +106,7 @@
 </template>
 
 <script setup>
-  import { ref, reactive, unref, watchPostEffect, watch } from 'vue';
+  import { ref, reactive, unref, watch } from 'vue';
   import sheep from '@/sheep';
   import { realName, bankName, bankCode, alipayAccount } from '@/sheep/validate/form';
 

+ 152 - 169
pages/pay/components/account-type-select.vue

@@ -1,176 +1,159 @@
 <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">
-				<radio-group @change="onChange">
-					<label 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>
-
-						<radio :value="item.value" color="var(--ui-BG-Main)"
-							:checked="item.value === state.currentValue" />
-						<!-- :disabled="!methods.includes(item.value)" -->
-					</label>
-				</radio-group>
-			</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>
+  <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">
+        <radio-group @change="onChange">
+          <label
+            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>
+            <radio
+              :value="item.value"
+              color="var(--ui-BG-Main)"
+              :checked="item.value === state.currentValue"
+              :disabled="!methods.includes(parseInt(item.value))"
+            />
+          </label>
+        </radio-group>
+      </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,
-		ref
-	} 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: '0',
-	});
-	const typeList = reactive([{
-			// icon: '/static/img/shop/pay/wechat.png',
-			title: '工商银行',
-			value: '0',
-		},
-		{
-			// icon: '/static/img/shop/pay/alipay.png',
-			title: '建设银行',
-			value: '1',
-		},
-		{
-			// icon: '/static/img/shop/pay/bank.png',
-			title: '农业',
-			value: '2',
-		},
-	])
-	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();
-	});
+  import { reactive } 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/wechat.png', // TODO 芋艿:后续给个 icon
+      title: '钱包余额',
+      value: '1',
+    },
+    {
+      icon: '/static/img/shop/pay/wechat.png',
+      title: '微信零钱',
+      value: '2',
+    },
+    {
+      icon: '/static/img/shop/pay/alipay.png',
+      title: '支付宝账户',
+      value: '3',
+    },
+    {
+      icon: '/static/img/shop/pay/bank.png',
+      title: '银行卡转账',
+      value: '4',
+    },
+  ];
+
+  function onChange(e) {
+    state.currentValue = e.detail.value;
+  }
+
+  const onConfirm = async () => {
+    if (state.currentValue === '') {
+      sheep.$helper.toast('请选择提现方式');
+      return;
+    }
+    // 赋值
+    emits('update:modelValue', {
+      type: state.currentValue
+    });
+    // 关闭弹窗
+    emits('close');
+  };
+
+  const hideModal = () => {
+    emits('close');
+  };
 </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%;
-	}
-</style>
+  .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%;
+  }
+</style>

+ 412 - 414
pages/pay/withdraw.vue

@@ -1,425 +1,423 @@
 <template>
-	<s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
-		<!-- <view class="page-bg"></view> -->
-		<!-- 	<view class="wallet-num-box ss-flex ss-col-center ss-row-between" :style="[
+  <s-layout title="申请提现" class="withdraw-wrap" navbar="inner">
+    <view class="page-bg"></view>
+    <view
+      class="wallet-num-box ss-flex ss-col-center ss-row-between"
+      :style="[
         {
           marginTop: '-' + Number(statusBarHeight + 88) + 'rpx',
           paddingTop: Number(statusBarHeight + 108) + 'rpx',
         },
-      ]">
-			<view class="">
-				<view class="num-title">可提现金额(元)</view>
-				<view class="wallet-num">{{ userInfo.commission }}</view>
-			</view>
-			<button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')">提现记录</button>
-		</view> -->
-		<!-- 提现输入卡片-->
-		<view class="draw-card">
-			<view class="card-title">提现金额</view>
-			<view class="input-box ss-flex ss-col-center border-bottom">
-				<view class="unit">¥</view>
-				<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.amount" type="number"
-					placeholder="请输入提现金额" />
-			</view>
-			<view class="card-title" v-show='txfag==1'>持卡人</view>
-			<view class="input-box ss-flex ss-col-center border-bottom"  v-show='txfag==1'>
-				<view class="unit"></view>
-				<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.name"
-					placeholder="请输入持卡人姓名" />
-			</view>
-			<view class="card-title"  v-show='txfag==1'>卡号</view>
-			<view class="input-box ss-flex ss-col-center border-bottom"  v-show='txfag==1'>
-				<view class="unit"></view>
-				<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.accountNo"
-					placeholder="请输卡号" />
-			</view>
-			<view class="card-title">收款码</view>
-			<view class="input-box ss-flex ss-col-center border-bottom">
-				<view class="unit"></view>
-				<uni-easyinput :inputBorder="false" class="ss-flex-1 ss-p-l-10" v-model="state.accountQrCodeUrl"
-					placeholder="请输收款码地址" />
-			</view>
-			
-			<view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30" style='display:block'>
-				<view class="name">选择提现方式:</view>
-				<!-- <view class="bank-list ss-flex ss-col-center" style="margin-left:auto" >
-					<view class="empty-text">请选择提现方式</view>
-					<text class="cicon-forward"></text>
-				</view> -->
-					<uni-section title="单选" type="line">
-						<view class="uni-px-5 uni-pb-5" style='font-size:28rpx'>
-							<uni-data-checkbox v-model="txfag" :localdata="txList"></uni-data-checkbox>
-						</view>
-					</uni-section>
-			</view>
-			<view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30"  v-show='txfag==1'>
-				<view class="name">选择银行</view>
-				<view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
-					<view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
-					<view v-if="state.accountInfo.type === '0'" class="empty-text">工商银行</view>
-					<view v-if="state.accountInfo.type === '1'" class="empty-text">建设银行</view>
-					<view v-if="state.accountInfo.type === '2'" class="empty-text">农业银行</view>
-					<text class="cicon-forward"></text>
-				</view>
-			</view>
-			<view class="bind-box ss-flex ss-col-center ss-row-between" v-if="state.accountInfo.type">
-				<view class="placeholder-text" v-if="state.accountInfo.account_name">
-					{{ state.accountInfo.account_header }}|{{ state.accountInfo.account_name }}
-				</view>
-			</view>
-			<button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
-				确认提现
-			</button>
-		</view>
-
-		<!-- 提现说明 -->
-		<view class="draw-notice">
-			<view class="title ss-m-b-30">提现说明</view>
-			<!-- <view class="draw-list" v-for="(rule, index) in state.rulesList" :key="index">
-				{{ index + 1 }}.{{ rule }}
-			</view>-->
-			<view class="draw-list">
-				当前可提现金额:<text>¥{{state.userGet.brokeragePrice}}</text>
-			</view>
-			<view class="draw-list">
-				冻结佣金:<text>¥{{state.userGet.frozenPrice}}</text>
-			</view>
-			<view class="draw-list">
-				说明:每笔佣金冻结期为0天,到期后可提现
-			</view>
-		</view>
-
-		<!-- 选择提现账户 -->
-		<account-type-select :show="state.accountSelect" @close="onAccountSelect(false)" round="10"
-			v-model="state.accountInfo" :methods="state.rules.methods" />
-		<!-- 编辑账户信息 -->
-		<account-info-modal v-if="state.accountInfo.type" v-model="state.accountInfo" :show="state.accountEdit"
-			@close="onAccountEdit(false)" round="10" />
-	</s-layout>
+      ]"
+    >
+      <view class="">
+        <view class="num-title">可提现金额(元)</view>
+        <view class="wallet-num">{{ fen2yuan(state.brokerageInfo.brokeragePrice) }}</view>
+      </view>
+      <button class="ss-reset-button log-btn" @tap="sheep.$router.go('/pages/pay/withdraw-log')">
+        提现记录
+      </button>
+    </view>
+    <!-- 提现输入卡片-->
+    <view class="draw-card">
+      <view class="bank-box ss-flex ss-col-center ss-row-between ss-m-b-30">
+        <view class="name">提现至</view>
+        <view class="bank-list ss-flex ss-col-center" @tap="onAccountSelect(true)">
+          <view v-if="!state.accountInfo.type" class="empty-text">请选择提现方式</view>
+          <view v-if="state.accountInfo.type === '1'" class="empty-text">钱包余额</view>
+          <view v-if="state.accountInfo.type === '2'" class="empty-text">微信零钱</view>
+          <view v-if="state.accountInfo.type === '3'" class="empty-text">支付宝账户</view>
+          <view v-if="state.accountInfo.type === '4'" class="empty-text">银行卡转账</view>
+          <text class="cicon-forward" />
+        </view>
+      </view>
+      <!-- 提现金额 -->
+      <view class="card-title">提现金额</view>
+      <view class="input-box ss-flex ss-col-center border-bottom">
+        <view class="unit">¥</view>
+        <uni-easyinput
+          :inputBorder="false"
+          class="ss-flex-1 ss-p-l-10"
+          v-model="state.accountInfo.price"
+          type="number"
+          placeholder="请输入提现金额"
+        />
+      </view>
+      <!-- 提现账号 -->
+      <view class="card-title" v-show="['2', '3', '4'].includes(state.accountInfo.type)">
+        提现账号
+      </view>
+      <view
+        class="input-box ss-flex ss-col-center border-bottom"
+        v-show="['2', '3', '4'].includes(state.accountInfo.type)"
+      >
+        <view class="unit" />
+        <uni-easyinput
+          :inputBorder="false"
+          class="ss-flex-1 ss-p-l-10"
+          v-model="state.accountInfo.accountNo"
+          placeholder="请输入提现账号"
+        />
+      </view>
+      <!-- TODO 芋艿: -->
+      <view class="card-title" v-show="['2', '3'].includes(state.accountInfo.type)">收款码</view>
+      <view
+        class="input-box ss-flex ss-col-center border-bottom"
+        v-show="['2', '3'].includes(state.accountInfo.type)"
+      >
+        <view class="unit" />
+        <uni-easyinput
+          :inputBorder="false"
+          class="ss-flex-1 ss-p-l-10"
+          v-model="state.accountInfo.accountQrCodeUrl"
+          placeholder="请输收款码地址"
+        />
+      </view>
+      <!-- 持卡人姓名 -->
+      <view class="card-title" v-show="state.accountInfo.type === '4'">持卡人</view>
+      <view
+        class="input-box ss-flex ss-col-center border-bottom"
+        v-show="state.accountInfo.type === '4'"
+      >
+        <view class="unit" />
+        <uni-easyinput
+          :inputBorder="false"
+          class="ss-flex-1 ss-p-l-10"
+          v-model="state.accountInfo.name"
+          placeholder="请输入持卡人姓名"
+        />
+      </view>
+      <!-- 提现银行 -->
+      <view class="card-title" v-show="state.accountInfo.type === '4'">提现银行</view>
+      <view
+        class="input-box ss-flex ss-col-center border-bottom"
+        v-show="state.accountInfo.type === '4'"
+      >
+        <view class="unit" />
+        <uni-easyinput
+          :inputBorder="false"
+          class="ss-flex-1 ss-p-l-10"
+          v-model="state.accountInfo.bankName"
+          placeholder="请输入提现银行"
+        />
+      </view>
+      <!-- 开户地址 -->
+      <view class="card-title" v-show="state.accountInfo.type === '4'">开户地址</view>
+      <view
+        class="input-box ss-flex ss-col-center border-bottom"
+        v-show="state.accountInfo.type === '4'"
+      >
+        <view class="unit" />
+        <uni-easyinput
+          :inputBorder="false"
+          class="ss-flex-1 ss-p-l-10"
+          v-model="state.accountInfo.bankAddress"
+          placeholder="请输入开户地址"
+        />
+      </view>
+      <button class="ss-reset-button save-btn ui-BG-Main-Gradient ui-Shadow-Main" @tap="onConfirm">
+        确认提现
+      </button>
+    </view>
+
+    <!-- 提现说明 -->
+    <view class="draw-notice">
+      <view class="title ss-m-b-30">提现说明</view>
+      <view class="draw-list"> 最低提现金额 {{ fen2yuan(state.minPrice) }} 元 </view>
+      <view class="draw-list">
+        冻结佣金:<text>¥{{ fen2yuan(state.brokerageInfo.frozenPrice) }}</text>
+        (每笔佣金的冻结期为 {{ state.frozenDays }} 天,到期后可提现)
+      </view>
+    </view>
+
+    <!-- 选择提现账户 -->
+    <account-type-select
+      :show="state.accountSelect"
+      @close="onAccountSelect(false)"
+      round="10"
+      v-model="state.accountInfo"
+      :methods="state.withdrawTypes"
+    />
+  </s-layout>
 </template>
 
 <script setup>
-	import {
-		computed,
-		reactive,
-		onBeforeMount,ref
-	} from 'vue';
-	import sheep from '@/sheep';
-	import accountTypeSelect from './components/account-type-select.vue';
-	import accountInfoModal from './components/account-info-modal.vue';
-	import {
-		onPageScroll
-	} from '@dcloudio/uni-app';
-	const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
-	onPageScroll(() => {});
-	const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
-
-	function filterRules(rules) {
-		let list = [];
-		let str1 = '';
-		if (rules.min_amount > 0) {
-			str1 += `最少 ${rules.min_amount}元; `;
-		}
-		if (rules.max_amount > 0) {
-			str1 += `最多 ${rules.max_amount}元;`;
-		}
-		if (str1 !== '') {
-			list.push('单次提现金额 ' + str1);
-		}
-
-		if (rules.max_num > 0) {
-			list.push(`每${rules.num_unit === 'day' ? '天' : '月'}最多可提现 ${rules.max_num} 次;`);
-		}
-
-		if (rules.charge_rate_format > 0) {
-			list.push(`每次收取提现手续费 ${rules.charge_rate_format}%;`);
-		}
-		list.push(
-			`提现申请后将${rules.auto_arrival ? '自动' : '审核后'}到账, 到账结果请查收对应渠道服务通知;`,
-		);
-		list.push('如有疑问请及时联系客服.');
-
-		return list;
-	}
-	let txfag=ref(1)
-	const txList=[{text:'银行卡提现',value:1},{text:'微信提现',value:2},{text:'支付宝提现',value:3}]
-	function tixian(v){
-		console.log(v)
-	}
-	const userStore = sheep.$store('user');
-	const userInfo = computed(() => userStore.userInfo);
-	const state = reactive({
-		userGet: {},
-		accountNo: '',
-		name: '',
-		amount: '',
-		type: '',
-		accountInfo: {},
-		accountSelect: false,
-		accountEdit: false,
-		rules: {
-			min_amount: 0,
-			max_amount: 0,
-			max_num: 0,
-			num_unit: 0,
-			charge_rate_format: 0,
-			charge_rate: 0,
-			methods: [],
-		},
-		rulesList: [],
-		accountQrCodeUrl:''
-	});
-
-	const onAccountEdit = (e) => {
-		state.accountEdit = e;
-	};
-
-	const onAccountSelect = (e) => {
-		state.accountSelect = e;
-	};
-
-	const onConfirm = async () => {
-		let payload = {
-			accountNo: state.accountNo,
-			name: state.name,
-			bankName: state.accountInfo.type,
-			type: txfag.value,
-			price: state.amount * 100,
-			accountQrCodeUrl:state.accountQrCodeUrl
-		};
-		console.log(payload);
-		// return;
-		// if (payload.money > userInfo.commission || payload.money <= 0) {
-		// 	sheep.$helper.toast('请输入正确的提现金额');
-		// 	return;
-		// }
-
-		// if (!payload.type) {
-		// 	sheep.$helper.toast('请选择提现方式');
-		// 	return;
-		// }
-
-		// if (!payload.account_name || !payload.account_header || !payload.account_no) {
-		// 	sheep.$helper.toast('请完善您的账户信息');
-		// 	return;
-		// }
-
-		// if (sheep.$platform.name === 'H5' && payload.type === 'wechat') {
-		// 	sheep.$helper.toast('请使用微信浏览器操作');
-		// 	return;
-		// }
-
-		let {
-			code,
-			msg,
-			data
-		} = await sheep.$api.pay.withdraw.apply(payload);
-		if (code === -1) {
-			sheep.$platform.useProvider('wechat').bind();
-		}
-		if (code === 0) {
-			userStore.getInfo();
-			uni.showModal({
-				title: '操作成功',
-				content: '您的提现申请已成功提交',
-				cancelText: '继续提现',
-				confirmText: '查看记录',
-				success: function(res) {
-					res.confirm && sheep.$router.go('/pages/pay/withdraw-log');
-				},
-			});
-		}
-	};
-
-	async function getWithdrawRules() {
-		let {
-			error,
-			data
-		} = await sheep.$api.pay.withdraw.rules();
-		if (error === 0) {
-			state.rules = data;
-			state.rulesList = filterRules(state.rules);
-		}
-	}
-
-	onBeforeMount(async () => {
-		getWithdrawRules();
-		let res = await sheep.$api.pay.withdraw.userGet();
-		state.userGet = res.data
-	});
+  import { computed, reactive, onBeforeMount, ref } from 'vue';
+  import sheep from '@/sheep';
+  import accountTypeSelect from './components/account-type-select.vue';
+  import { fen2yuan } from '@/sheep/hooks/useGoods';
+  import TradeConfigApi from '@/sheep/api/trade/config';
+  import BrokerageApi from '@/sheep/api/trade/brokerage';
+
+  const headerBg = sheep.$url.css('/static/img/shop/user/withdraw_bg.png');
+  const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
+
+  const userStore = sheep.$store('user');
+  const userInfo = computed(() => userStore.userInfo);
+  const state = reactive({
+    accountInfo: {
+      // 提现表单
+      type: undefined,
+      accountNo: undefined,
+      accountQrCodeUrl: undefined,
+      name: undefined,
+      bankName: undefined,
+      bankAddress: undefined,
+    },
+
+    accountSelect: false,
+
+    brokerageInfo: {}, // 分销信息
+
+    frozenDays: 0, // 冻结天数
+    minPrice: 0, // 最低提现金额
+    withdrawTypes: [], // 提现方式
+  });
+
+  // 打开提现方式的弹窗
+  const onAccountSelect = (e) => {
+    state.accountSelect = e;
+  };
+
+  // 提交提现
+  const onConfirm = async () => {
+    // 参数校验
+    debugger;
+    if (
+      !state.accountInfo.price ||
+      state.accountInfo.price > state.brokerageInfo.price ||
+      state.accountInfo.price <= 0
+    ) {
+      sheep.$helper.toast('请输入正确的提现金额');
+      return;
+    }
+    if (!state.accountInfo.type) {
+      sheep.$helper.toast('请选择提现方式');
+      return;
+    }
+    // 提交请求
+    let { code } = await BrokerageApi.createBrokerageWithdraw({
+      ...state.accountInfo,
+      price: state.accountInfo.price * 100,
+    });
+    if (code !== 0) {
+      return;
+    }
+    // 提示
+    uni.showModal({
+      title: '操作成功',
+      content: '您的提现申请已成功提交',
+      cancelText: '继续提现',
+      confirmText: '查看记录',
+      success: (res) => {
+        if (res.confirm) {
+          sheep.$router.go('/pages/pay/withdraw-log')
+          return;
+        }
+        getBrokerageUser();
+        state.accountInfo = {};
+      }
+    });
+  };
+
+  // 获得分销配置
+  async function getWithdrawRules() {
+    let { code, data } = await TradeConfigApi.getTradeConfig();
+    if (code !== 0) {
+      return;
+    }
+    if (data) {
+      state.minPrice = data.brokerageWithdrawMinPrice || 0;
+      state.frozenDays = data.brokerageFrozenDays || 0;
+      state.withdrawTypes = data.brokerageWithdrawTypes;
+    }
+  }
+
+  // 获得分销信息
+  async function getBrokerageUser() {
+    const { data, code } = await BrokerageApi.getBrokerageUser();
+    if (code === 0) {
+      state.brokerageInfo = data;
+    }
+  }
+
+  onBeforeMount(() => {
+    getWithdrawRules();
+    getBrokerageUser()
+  })
 </script>
 
 <style lang="scss" scoped>
-	:deep() {
-		.uni-input-input {
-			font-family: OPPOSANS !important;
-		}
-	}
-
-	.wallet-num-box {
-		padding: 0 40rpx 80rpx;
-		background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
-		border-radius: 0 0 5% 5%;
-
-		.num-title {
-			font-size: 26rpx;
-			font-weight: 500;
-			color: $white;
-			margin-bottom: 20rpx;
-		}
-
-		.wallet-num {
-			font-size: 60rpx;
-			font-weight: 500;
-			color: $white;
-			font-family: OPPOSANS;
-		}
-
-		.log-btn {
-			width: 170rpx;
-			height: 60rpx;
-			line-height: 60rpx;
-			border: 1rpx solid $white;
-			border-radius: 30rpx;
-			padding: 0;
-			font-size: 26rpx;
-			font-weight: 500;
-			color: $white;
-		}
-	}
-
-	// 提现输入卡片
-	.draw-card {
-		background-color: $white;
-		border-radius: 20rpx;
-		width: 690rpx;
-		min-height: 560rpx;
-		margin: -60rpx 30rpx 30rpx 30rpx;
-		padding: 30rpx;
-		position: relative;
-		z-index: 3;
-		box-sizing: border-box;
-
-		.card-title {
-			font-size: 30rpx;
-			font-weight: 500;
-			margin-bottom: 30rpx;
-		}
-
-		.bank-box {
-			.name {
-				font-size: 28rpx;
-				font-weight: 500;
-			}
-
-			.bank-list {
-				.empty-text {
-					font-size: 28rpx;
-					font-weight: 400;
-					color: $dark-9;
-				}
-
-				.cicon-forward {
-					color: $dark-9;
-				}
-			}
-
-			.input-box {
-				width: 624rpx;
-				height: 100rpx;
-				margin-bottom: 40rpx;
-
-				.unit {
-					font-size: 48rpx;
-					color: #333;
-					font-weight: 500;
-				}
-
-				.uni-easyinput__placeholder-class {
-					font-size: 30rpx;
-					height: 36rpx;
-				}
-
-				:deep(.uni-easyinput__content-input) {
-					font-size: 48rpx;
-				}
-			}
-
-			.save-btn {
-				width: 616rpx;
-				height: 86rpx;
-				line-height: 86rpx;
-				border-radius: 40rpx;
-				margin-top: 80rpx;
-			}
-		}
-
-		.bind-box {
-			.placeholder-text {
-				font-size: 26rpx;
-				color: $dark-9;
-			}
-
-			.add-btn {
-				width: 100rpx;
-				height: 50rpx;
-				border-radius: 25rpx;
-				line-height: 50rpx;
-				font-size: 22rpx;
-				color: var(--ui-BG-Main);
-				background-color: var(--ui-BG-Main-light);
-			}
-		}
-
-		.input-box {
-			width: 624rpx;
-			height: 100rpx;
-			margin-bottom: 40rpx;
-
-			.unit {
-				font-size: 48rpx;
-				color: #333;
-				font-weight: 500;
-			}
-
-			.uni-easyinput__placeholder-class {
-				font-size: 30rpx;
-			}
-
-			:deep(.uni-easyinput__content-input) {
-				font-size: 48rpx;
-			}
-		}
-
-		.save-btn {
-			width: 616rpx;
-			height: 86rpx;
-			line-height: 86rpx;
-			border-radius: 40rpx;
-			margin-top: 80rpx;
-		}
-	}
-
-	// 提现说明
-	.draw-notice {
-		width: 684rpx;
-		background: #ffffff;
-		border: 2rpx solid #fffaee;
-		border-radius: 20rpx;
-		margin: 20rpx 32rpx 0 32rpx;
-		padding: 30rpx;
-		box-sizing: border-box;
-
-		.title {
-			font-weight: 500;
-			color: #333333;
-			font-size: 30rpx;
-		}
-
-		.draw-list {
-			font-size: 24rpx;
-			color: #999999;
-			line-height: 46rpx;
-		}
-	}
-</style>
+  :deep() {
+    .uni-input-input {
+      font-family: OPPOSANS !important;
+    }
+  }
+
+  .wallet-num-box {
+    padding: 0 40rpx 80rpx;
+    background: var(--ui-BG-Main) v-bind(headerBg) center/750rpx 100% no-repeat;
+    border-radius: 0 0 5% 5%;
+
+    .num-title {
+      font-size: 26rpx;
+      font-weight: 500;
+      color: $white;
+      margin-bottom: 20rpx;
+    }
+
+    .wallet-num {
+      font-size: 60rpx;
+      font-weight: 500;
+      color: $white;
+      font-family: OPPOSANS;
+    }
+
+    .log-btn {
+      width: 170rpx;
+      height: 60rpx;
+      line-height: 60rpx;
+      border: 1rpx solid $white;
+      border-radius: 30rpx;
+      padding: 0;
+      font-size: 26rpx;
+      font-weight: 500;
+      color: $white;
+    }
+  }
+
+  // 提现输入卡片
+  .draw-card {
+    background-color: $white;
+    border-radius: 20rpx;
+    width: 690rpx;
+    min-height: 560rpx;
+    margin: -60rpx 30rpx 30rpx 30rpx;
+    padding: 30rpx;
+    position: relative;
+    z-index: 3;
+    box-sizing: border-box;
+
+    .card-title {
+      font-size: 30rpx;
+      font-weight: 500;
+      margin-bottom: 30rpx;
+    }
+
+    .bank-box {
+      .name {
+        font-size: 28rpx;
+        font-weight: 500;
+      }
+
+      .bank-list {
+        .empty-text {
+          font-size: 28rpx;
+          font-weight: 400;
+          color: $dark-9;
+        }
+
+        .cicon-forward {
+          color: $dark-9;
+        }
+      }
+
+      .input-box {
+        width: 624rpx;
+        height: 100rpx;
+        margin-bottom: 40rpx;
+
+        .unit {
+          font-size: 48rpx;
+          color: #333;
+          font-weight: 500;
+        }
+
+        .uni-easyinput__placeholder-class {
+          font-size: 30rpx;
+          height: 36rpx;
+        }
+
+        :deep(.uni-easyinput__content-input) {
+          font-size: 48rpx;
+        }
+      }
+
+      .save-btn {
+        width: 616rpx;
+        height: 86rpx;
+        line-height: 86rpx;
+        border-radius: 40rpx;
+        margin-top: 80rpx;
+      }
+    }
+
+    .bind-box {
+      .placeholder-text {
+        font-size: 26rpx;
+        color: $dark-9;
+      }
+
+      .add-btn {
+        width: 100rpx;
+        height: 50rpx;
+        border-radius: 25rpx;
+        line-height: 50rpx;
+        font-size: 22rpx;
+        color: var(--ui-BG-Main);
+        background-color: var(--ui-BG-Main-light);
+      }
+    }
+
+    .input-box {
+      width: 624rpx;
+      height: 100rpx;
+      margin-bottom: 40rpx;
+
+      .unit {
+        font-size: 48rpx;
+        color: #333;
+        font-weight: 500;
+      }
+
+      .uni-easyinput__placeholder-class {
+        font-size: 30rpx;
+      }
+
+      :deep(.uni-easyinput__content-input) {
+        font-size: 48rpx;
+      }
+    }
+
+    .save-btn {
+      width: 616rpx;
+      height: 86rpx;
+      line-height: 86rpx;
+      border-radius: 40rpx;
+      margin-top: 80rpx;
+    }
+  }
+
+  // 提现说明
+  .draw-notice {
+    width: 684rpx;
+    background: #ffffff;
+    border: 2rpx solid #fffaee;
+    border-radius: 20rpx;
+    margin: 20rpx 32rpx 0 32rpx;
+    padding: 30rpx;
+    box-sizing: border-box;
+
+    .title {
+      font-weight: 500;
+      color: #333333;
+      font-size: 30rpx;
+    }
+
+    .draw-list {
+      font-size: 24rpx;
+      color: #999999;
+      line-height: 46rpx;
+    }
+  }
+</style>

+ 0 - 44
sheep/api/pay.js

@@ -1,44 +0,0 @@
-import request from '@/sheep/request';
-
-export default {
-	// 发起提现
-	withdraw: {
-		list: (params) =>
-			request({
-				url: 'withdraw',
-				method: 'GET',
-				params,
-				custom: {
-					auth: true,
-				},
-			}),
-		rules: () =>
-			request({
-				url: 'withdraw/rules',
-				method: 'GET',
-				custom: {
-					auth: true,
-				},
-			}),
-		apply: (data) =>
-			request({
-				url: '/app-api/trade/brokerage-withdraw/create',
-				method: 'POST',
-				data,
-				custom: {
-					loadingMsg: '申请中',
-					// auth: true,
-				},
-			}),
-		userGet: (params) =>
-			request({
-				url: '/app-api/trade/brokerage-user/get',
-				method: 'GET',
-				params,
-				// custom: {
-				//   loadingMsg: '申请中',
-				//   auth: true,
-				// },
-			}),
-	},
-};

+ 63 - 69
uni_modules/uni-data-checkbox/components/uni-data-checkbox/uni-data-checkbox.vue

@@ -154,20 +154,18 @@
 			},
 			value(newVal) {
 				this.dataList = this.getDataList(newVal)
-        // TODO @芋艿:这块可能被错误的注释了,需要跟进下
 				// fix by mehaotian is_reset 在 uni-forms 中定义
-				// if(!this.is_reset){
-				// 	this.is_reset = false
-				// 	this.formItem && this.formItem.setValue(newVal)
-				// }
+				if(!this.is_reset){
+					this.is_reset = false
+					this.formItem && this.formItem.setValue(newVal)
+				}
 			},
 			modelValue(newVal) {
 				this.dataList = this.getDataList(newVal);
-        // TODO @芋艿:这块可能被错误的注释了,需要跟进下
-				// if(!this.is_reset){
-				// 	this.is_reset = false
-				// 	this.formItem && this.formItem.setValue(newVal)
-				// }
+				if(!this.is_reset){
+					this.is_reset = false
+					this.formItem && this.formItem.setValue(newVal)
+				}
 			}
 		},
 		data() {
@@ -195,22 +193,22 @@
 			}
 		},
 		created() {
-			// this.form = this.getForm('uniForms')
-			// this.formItem = this.getForm('uniFormsItem')
+			this.form = this.getForm('uniForms')
+			this.formItem = this.getForm('uniFormsItem')
 			// this.formItem && this.formItem.setValue(this.value)
 
-			// if (this.formItem) {
-			// 	this.isTop = 6
-			// 	if (this.formItem.name) {
-			// 		// 如果存在name添加默认值,否则formData 中不存在这个字段不校验
-			// 		if(!this.is_reset){
-			// 			this.is_reset = false
-			// 			this.formItem.setValue(this.dataValue)
-			// 		}
-			// 		this.rename = this.formItem.name
-			// 		this.form.inputChildrens.push(this)
-			// 	}
-			// }
+			if (this.formItem) {
+				this.isTop = 6
+				if (this.formItem.name) {
+					// 如果存在name添加默认值,否则formData 中不存在这个字段不校验
+					if(!this.is_reset){
+						this.is_reset = false
+						this.formItem.setValue(this.dataValue)
+					}
+					this.rename = this.formItem.name
+					this.form.inputChildrens.push(this)
+				}
+			}
 
 			if (this.localdata && this.localdata.length !== 0) {
 				this.isLocal = true
@@ -275,7 +273,7 @@
 						}
 					}
 				}
-				// this.formItem && this.formItem.setValue(detail.value)
+				this.formItem && this.formItem.setValue(detail.value)
 				// TODO 兼容 vue2
 				this.$emit('input', detail.value);
 				// // TOTO 兼容 vue3
@@ -377,7 +375,7 @@
 						selectedArr.push(item[this.map.value])
 					}
 				})
-				return this.dataValue.length > 0 ? this.dataValue : selectedArr
+				return this.dataValue && this.dataValue.length > 0 ? this.dataValue : selectedArr
 			},
 
 			/**
@@ -386,13 +384,11 @@
 			setStyleBackgroud(item) {
 				let styles = {}
 				let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
-				if (this.selectedColor) {
-					if (this.mode !== 'list') {
-						styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
-					}
-					if (this.mode === 'tag') {
-						styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
-					}
+				if (this.mode !== 'list') {
+					styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
+				}
+				if (this.mode === 'tag') {
+					styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
 				}
 				let classles = ''
 				for (let i in styles) {
@@ -403,16 +399,15 @@
 			setStyleIcon(item) {
 				let styles = {}
 				let classles = ''
-				if (this.selectedColor) {
-					let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
-					styles['background-color'] = item.selected?selectedColor:'#fff'
-					styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
+				let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
+				styles['background-color'] = item.selected?selectedColor:'#fff'
+				styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
 
-					if(!item.selected && item.disabled){
-						styles['background-color'] = '#F2F6FC'
-						styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
-					}
+				if(!item.selected && item.disabled){
+					styles['background-color'] = '#F2F6FC'
+					styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
 				}
+
 				for (let i in styles) {
 					classles += `${i}:${styles[i]};`
 				}
@@ -421,17 +416,16 @@
 			setStyleIconText(item) {
 				let styles = {}
 				let classles = ''
-				if (this.selectedColor) {
-					let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
-					if (this.mode === 'tag') {
-						styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
-					} else {
-						styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:selectedColor):'#666'
-					}
-					if(!item.selected && item.disabled){
-						styles.color = '#999'
-					}
+				let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
+				if (this.mode === 'tag') {
+					styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
+				} else {
+					styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:selectedColor):'#666'
 				}
+				if(!item.selected && item.disabled){
+					styles.color = '#999'
+				}
+
 				for (let i in styles) {
 					classles += `${i}:${styles[i]};`
 				}
@@ -454,7 +448,7 @@
 </script>
 
 <style lang="scss">
-	$uni-primary: #2979ff !default;
+	$checked-color: #2979ff;
 	$border-color: #DCDFE6;
 	$disable:0.4;
 
@@ -620,8 +614,8 @@
 					// 选中
 					&.is-checked {
 						.checkbox__inner {
-							border-color: $uni-primary;
-							background-color: $uni-primary;
+							border-color: $checked-color;
+							background-color: $checked-color;
 
 							.checkbox__inner-icon {
 								opacity: 1;
@@ -629,14 +623,14 @@
 							}
 						}
 						.radio__inner {
-							border-color: $uni-primary;
+							border-color: $checked-color;
 							.radio__inner-icon {
 								opacity: 1;
-								background-color: $uni-primary;
+								background-color: $checked-color;
 							}
 						}
 						.checklist-text {
-							color: $uni-primary;
+							color: $checked-color;
 						}
 						// 选中禁用
 						&.is-disable {
@@ -689,10 +683,10 @@
 					}
 
 					&.is-checked {
-						border-color: $uni-primary;
+						border-color: $checked-color;
 						.checkbox__inner {
-							border-color: $uni-primary;
-							background-color: $uni-primary;
+							border-color: $checked-color;
+							background-color: $checked-color;
 							.checkbox__inner-icon {
 								opacity: 1;
 								transform: rotate(45deg);
@@ -700,16 +694,16 @@
 						}
 
 						.radio__inner {
-							border-color: $uni-primary;
+							border-color: $checked-color;
 
 							.radio__inner-icon {
 								opacity: 1;
-								background-color: $uni-primary;
+								background-color: $checked-color;
 							}
 						}
 
 						.checklist-text {
-							color: $uni-primary;
+							color: $checked-color;
 						}
 
 						// 选中禁用
@@ -741,8 +735,8 @@
 					}
 
 					&.is-checked {
-						background-color: $uni-primary;
-						border-color: $uni-primary;
+						background-color: $checked-color;
+						border-color: $checked-color;
 
 						.checklist-text {
 							color: #fff;
@@ -781,8 +775,8 @@
 
 					&.is-checked {
 						.checkbox__inner {
-							border-color: $uni-primary;
-							background-color: $uni-primary;
+							border-color: $checked-color;
+							background-color: $checked-color;
 
 							.checkbox__inner-icon {
 								opacity: 1;
@@ -795,13 +789,13 @@
 							}
 						}
 						.checklist-text {
-							color: $uni-primary;
+							color: $checked-color;
 						}
 
 						.checklist-content {
 							.checkobx__list {
 								opacity: 1;
-								border-color: $uni-primary;
+								border-color: $checked-color;
 							}
 						}