增加提现功能

This commit is contained in:
TOP糯米 2023-03-18 14:08:29 +08:00
parent d1f396a991
commit 82516a56af
3 changed files with 84 additions and 7 deletions

View File

@ -28,12 +28,25 @@ const apis = {
}, },
info: { info: {
url: "/user/workerinfo/getuserinfo", url: "/user/workerinfo/getuserinfo",
showLoading: true,
auth: true, auth: true,
}, },
setServiceInfo: { setServiceInfo: {
url: "/user/workerinfo/setinfo", url: "/user/workerinfo/setinfo",
auth: true, auth: true,
}, },
withdraw: {
withdraw: {
url: "/user/workerinfo/drawmoney",
showLoading: true,
auth: true,
},
explain: {
url: "/wxapp/index/getdistributionmoney",
showLoading: true,
auth: true,
}
}
}, },
service: { service: {
cate: { cate: {

View File

@ -247,5 +247,38 @@ export default {
prototype.$utils.toast('注销成功').then(() => { prototype.$utils.toast('注销成功').then(() => {
prototype.$utils.toPage('/pages/index/index', {}, 'switch'); prototype.$utils.toPage('/pages/index/index', {}, 'switch');
}); });
},
/**
* 提现
*/
withdraw(money) {
return new Promise((resolve, reject) => {
prototype.$request({
api: "user.withdraw.withdraw",
data: {
money: money
}
}).then(response => {
if (response.code == 1) {
return resolve(response);
}
return reject(response.msg);
}).catch(e => { });
});
},
/**
* 提现说明
*/
withdrawExplain() {
return new Promise((resolve, reject) => {
prototype.$request({
api: "user.withdraw.explain",
}).then(response => {
if (response.code == 1) {
return resolve(response.data);
}
return reject(response.msg);
}).catch(e => { });
});
} }
} }

View File

@ -8,46 +8,77 @@
class="input" class="input"
type="number" type="number"
v-model="money" v-model="money"
placeholder="请输入提现金额不可低于20元" :placeholder="'请输入提现金额,不可低于' + min + '元'"
placeholder-class="placeholder-style-4" placeholder-class="placeholder-style-4"
/> />
</view> </view>
<view class="total-box"> <view class="total-box">
<text class="text">可提现金额</text> <text class="text">可提现金额</text>
<text class="num">¥0.00</text> <text class="num">¥ {{ balance }}</text>
</view> </view>
</view> </view>
<view class="withdraw-section withdraw-desc"> <view class="withdraw-section withdraw-desc">
<view class="title">提现说明</view> <view class="title">提现说明</view>
<view class="content"> <view class="content">
1提现周期为每周三提现一次2小时内到账 2请谨慎绑定微信号信息错误将导致错误打款责任由师傅自行承担 <rich-text :nodes="explain"></rich-text>
3家居售后问题通常在用户试用中出现如漏水渗水堵塞固定松动等因此平台对服务后订单设置7日反馈期反馈期内若服务无售后问题或非安装问题所造成售后反馈期过后该笔订单金额自动转入可提现余额
</view> </view>
</view> </view>
<view class="common-save-form-btn"> <view class="common-save-form-btn">
<view class="btn">确定提现</view> <view class="btn" @click="submit">确定提现</view>
</view> </view>
</app-layout> </app-layout>
</template> </template>
<script> <script>
import AppLayout from "@/components/layout/layout"; import AppLayout from "@/components/layout/layout";
import { mapState } from "vuex";
export default { export default {
name: "member-cash-withdraw", name: "member-cash-withdraw",
data() { data() {
return { return {
min: 0,
money: null, money: null,
balance: 0,
explain: "",
}; };
}, },
components: { components: {
AppLayout, AppLayout,
}, },
computed: {
...mapState({
userInfo: (state) => state.user.info,
}),
},
onLoad() {}, onLoad() {},
onShow() {}, async onShow() {
await this.$store.dispatch("user/info");
this.$models.user.serviceData().then((data) => {
this.balance = data.disposableBalance;
});
this.$models.user.withdrawExplain().then((data) => {
this.explain = data.tixian_content;
this.min = data.min;
});
},
onReady() {}, onReady() {},
onReachBottom() {}, onReachBottom() {},
onPullDownRefresh() {}, onPullDownRefresh() {},
methods: {}, methods: {
submit() {
if (this.money <= 0) {
return this.$utils.toast("请输入提现金额");
}
this.$models.user
.withdraw(this.money)
.then((response) => {
this.$utils.toast(response.msg);
})
.catch((e) => {
this.$utils.toast(e);
});
},
},
}; };
</script> </script>