供应商报价,绑卡,提现页面开发

This commit is contained in:
zmj 2024-05-17 14:25:17 +08:00
parent e0cead7127
commit aef4b7a279
13 changed files with 3567 additions and 1610 deletions

27
api/supplier.js Normal file
View File

@ -0,0 +1,27 @@
import request from "@/utils/requestSupplier.js";
//报价单列表
export const bindCradApi = (data) => {
return request.post('user/userbank/add_bank', data);
}
//报价单提交
export const bankListApi = (data) => {
return request.get('bank/bank/lists', data);
}
export const amountAccountApi = (data) => {
return request.get('user/UserWithdraw/amount_account', data);
}
export const UserWithdrawApi = (data) => {
return request.post('user/UserWithdraw/withdraw', data);
}
export const UserWithdrawIndexApi = (data) => {
return request.get('user/UserWithdraw/index', data);
}
export const UserWithdrawListsApi = (data) => {
return request.get('user/UserWithdraw/lists', data);
}

View File

@ -3,17 +3,7 @@
<view v-if="newData.status && newData.status.status" style="height: 100rpx;"></view>
<view class="foot" v-if="newData.status && newData.status.status">
<view class="page-footer" id="target" :style="{'background-color':newData.bgColor.color[0].item}">
<view class="foot-item" v-for="(item,index) in newData.menuList" :key="index" @click="goRouter(item)">
<block v-if="item.link == activeRouter">
<image :src="item.imgList[0]"></image>
<view class="txt" :style="{color:newData.activeTxtColor.color[0].item}">{{item.name}}
</view>
</block>
<block v-else>
<image :src="item.imgList[1]"></image>
<view class="txt" :style="{color:newData.txtColor.color[0].item}">{{item.name}}</view>
</block>
</view>
sdafsdfsdfsdfsdfsdf,dsfsdfsdfsdf
</view>
</view>
</view>

View File

@ -13,7 +13,7 @@ let VUE_APP_WS_URL = `ws://${location.hostname}?type=user`
let openPlantGrass = '-openPlantGrass-'
let httpSix, httpApi;
let httpSix, httpApi, httpTwo;
// const env = 'dev'; // 开发
// const env = 'prod'; // 生产
@ -23,16 +23,19 @@ switch (env) {
case 'prod':
httpApi = 'https://shop.lihaink.cn' // 生产
httpSix = 'https://new-worker.lihaink.cn'
httpTwo = 'https://erp.lihaink.cn'
wsApi = 'wss://shop.lihaink.cn'
break;
case 'prew':
httpApi = 'https://test.shop.lihaink.cn' //预发布环境
httpSix = 'https://ceshi-new-wokr.lihaink.cn'
httpTwo = 'https://erp.lihaink.cn'
wsApi = 'wss://test.shop.lihaink.cn'
break;
default:
httpApi = "https://crmeb-test.shop.lihaink.cn" // 测试
httpSix = 'https://ceshi-new-wokr.lihaink.cn'
httpTwo = 'https://erp.lihaink.cn'
// wsApi = 'ws://192.168.1.22:8324'
wsApi = 'wss://crmeb-test.shop.lihaink.cn'
}
@ -59,6 +62,7 @@ module.exports = {
VUE_APP_WS_URL: process.env.NODE_ENV == 'development' ? `${wsApi}?type=user` : VUE_APP_WS_URL,
// #endif
HTTP_REQUEST_URL_SIX: httpSix,
HTTP_REQUEST_URL_TWO: httpTwo,
openPlantGrass: openPlantGrass,
ENV: env,
HEADER: {

View File

@ -55,7 +55,46 @@
"navigationBarTitleText": "批发",
"navigationStyle": "custom"
}
}, {
},
{
"path": "pages/quote/list",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": "报价",
"navigationStyle": "custom"
}
},
{
"path": "pages/quote/index",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": "报价订单"
}
},
{
"path": "pages/quote/supplierFinancialy",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": "提现"
}
},
{
"path": "pages/quote/financialyDeatil",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": "提现明细"
}
},
{
"path": "pages/quote/bindAccout",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": "账户绑定"
}
},
{
"path": "pages/gather/gather",
"style": {
"enablePullDownRefresh": true,
@ -81,7 +120,7 @@
"path": "pages/order_addcart/order_addcart",
"style": {
"enablePullDownRefresh": true,
"navigationBarTitleText": "购物车",
"navigationBarTitleText": "报价",
"navigationStyle": "custom"
}
}, {
@ -1628,7 +1667,7 @@
"pagePath": "pages/order_addcart/order_addcart",
"iconPath": "static/tabbar_icon/d.png",
"selectedIconPath": "static/tabbar_icon/d-a.png",
"text": "购物车"
"text": "报价"
},
{
"pagePath": "pages/user/index",

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

246
pages/quote/bindAccout.vue Normal file
View File

@ -0,0 +1,246 @@
<template>
<view class="content">
<view class="action">
<view class="">
提现至
</view>
<view style="font-weight: bold;">
{{form.is_own?'对公账户':'个人账户'}}
</view>
<view style="display: flex;align-items: center;color: #20B128;" @click="showPop1=true">
<text>账户绑定</text> <u-icon color="#20B128" name="arrow-right"></u-icon>
</view>
</view>
<view class="form">
<u-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" labelWidth='70'>
<u-form-item label="开户银行" prop="userInfo.name" borderBottom ref="item1" @click="showPop=true">
<text style="padding-left: 20rpx;" v-if="form.bank_name">{{form.bank_name}}</text>
<text v-else style="color: #20B128;padding-left: 20rpx;">点击选择开户银行</text>
</u-form-item>
<u-form-item label="账户名称" prop="userInfo.name" borderBottom ref="item1">
<u-input style="border: none;" v-model="form.name" placeholder="请输入账户名称" />
</u-form-item>
<u-form-item label="银行账号" prop="userInfo.name" borderBottom ref="item1">
<u-input maxlength="19" style="border: none;" v-model="form.bank_code" type='number'
placeholder="请输入银行账号" />
</u-form-item>
<u-form-item label="开户网点" prop="userInfo.name" borderBottom ref="item1">
<u-input style="border: none;" v-model="form.bank_branch" placeholder="请输入开户网点" />
</u-form-item>
<u-form-item v-if="!form.is_own" label="身份证" prop="userInfo.name" borderBottom ref="item1">
<u-input style="border: none;" v-model="form.id_card" placeholder="请输入身份证" />
</u-form-item>
<u-form-item v-if="!form.is_own" label="电话" prop="userInfo.name" borderBottom ref="item1">
<u-input style="border: none;" v-model="form.phone" placeholder="请输入电话" />
</u-form-item>
</u-form>
</view>
<view class="" style="margin-top: 20rpx;color: red;" v-if="false">
审核失败,请重新提交审核
</view>
<view class="submit-btn">
<u-button text="提交绑定" @click="submit" shape="circle" color="#50C758"></u-button>
</view>
<u-popup :show="showPop" :round="10" mode="bottom" @close="showPop=false" @open="showPop=true">
<view class="popContent">
<view style="text-align: center;font-weight: bold;">请选择银行</view>
<u-icon name="close" color="#303133" size="24" @click="showPop=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></u-icon>
<view class="bank-list">
<view class="bank-li" v-for="item in bankList" :key='item.id' @click="choseBank(item)">
<u-image :show-loading="true" :src="item.image" width="60rpx" height="60rpx"></u-image>
<text style="margin-left: 20rpx;">{{item.name}}</text>
</view>
</view>
</view>
</u-popup>
<u-popup :show="showPop1" :round="10" mode="bottom" @close="showPop1=false" @open="showPop1=true">
<view class="popContent">
<view style="text-align: center;font-weight: bold;">请选择提现账户</view>
<u-icon name="close" color="#303133" size="24" @click="showPop1=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></u-icon>
<view class="bank-list">
<view class="bank-li" @click="choseAccount(0)">
<text>个人账户</text>
</view>
<view class="bank-li" @click="choseAccount(1)">
<text>对公账户</text>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
bindCradApi
} from "@/api/supplier.js"
export default {
data() {
return {
form: {
"name": "",
"bank_id": 1,
"bank_name": '',
"bank_code": "",
"bank_branch": "",
"financial_img": "",
"is_own": 0,
phone: '',
"id_card": "",
// "mer_id": userStore?.userInfo?.merchant?.mer_id,
// supplier_id: userStore?.userInfo?.supplier?.id,
// user_type: userStore?.userInfo?.merchant?.mer_id ? '1' : '2'
},
showPop: false,
bankList: [{
"id": 2,
"name": "农业银行5445",
"image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114200646493168.png"
},
{
"id": 1,
"name": "中国银行",
"image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png"
}
],
hasBindAccount: [{
"id": 297,
"supplier_id": 0,
"mer_id": 500,
"bank_id": 1,
"bank_code": "6213362109985515778",
"bank_branch": "迎晖路支行",
"name": "赵明军",
"id_card": "513701200012105613",
"phone": "19130550023",
"financial_img": "",
"is_own": 0,
"is_check": 1,
"fail_msg": null,
"admin_id": 1,
"create_time": "2024-05-14 16:49:31",
"update_time": "2024-05-14 16:50:04",
"delete_time": null,
"bank_name": "中国银行",
"bank_image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png"
},
{
"id": 298,
"supplier_id": 0,
"mer_id": 500,
"bank_id": 1,
"bank_code": "6213362109985515778",
"bank_branch": "迎晖路支行",
"name": "赵明军",
"id_card": "513701200012105613",
"phone": "19130550023",
"financial_img": "",
"is_own": 1,
"is_check": 1,
"fail_msg": null,
"admin_id": 1,
"create_time": "2024-05-14 18:16:21",
"update_time": "2024-05-14 18:17:21",
"delete_time": null,
"bank_name": "中国银行",
"bank_image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png"
}
],
showPop1: false
}
},
methods: {
navgo(url) {
uni.navigateTo({
url
})
},
getFormData(form, target) {
if (!target) {
form.value = {}
return
}
form.name = target.name || ''
form.bank_id = target.bank_id || ''
form.bank_name = target.bank_name || ''
form.bank_code = target.bank_code || ''
form.bank_branch = target.bank_branch || ''
form.phone = target.phone || ''
form.id_card = target.id_card || ''
form.is_own = target.is_own
},
choseAccount(type) {
this.getFormData(this.form, this.hasBindAccount[type])
this.showPop1 = false
},
choseBank(item) {
this.form.bank_name = item.name
this.form.bank_id = item.id
this.showPop = false
},
submit() {
bindCradApi({
...this.form
}).then(res => {
uni.navigateBack()
})
}
},
onLoad() {
uni.showTabBar()
}
}
</script>
<style lang="scss">
.content {
padding: 20rpx;
}
.popContent {
padding: 20rpx;
.bank-list {
overflow-y: auto;
position: relative;
max-height: 40vh;
.bank-li {
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx;
border-bottom: 1px solid #F8F9FA;
}
}
}
.action {
background-color: white;
border-radius: 16rpx 16rpx 16rpx 16rpx;
padding: 30rpx;
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
}
.form {
padding: 28rpx 30rpx;
background-color: white;
border-radius: 20rpx;
}
.submit-btn {
position: fixed;
bottom: 146rpx;
width: 710rpx;
}
</style>

View File

@ -0,0 +1,520 @@
<template>
<view class="content">
<view class="head">
<view class="head_conent">
<view class="sum">
<view class="text">已提现金额</view>
<u-count-to class="num" style="color: #F84221;" :startVal="0" :endVal="total" :decimals="2" bold
font-size="22"></u-count-to>
</view>
<view class="line"></view>
<view class="sum">
<view class="text">已提现次数</view>
<u-count-to class="num" :startVal="0" :endVal="count" bold font-size="22"></u-count-to>
</view>
</view>
</view>
<view style="margin-top: 20rpx; display: flex;align-items: center;" @click="showDate=true">
<text>{{formatTimestampToYearMonth(nowTimes) }}</text> <u-icon name="arrow-down"></u-icon>
</view>
<view class="recoder" v-if="lists.length">
<view class="card" v-for="(item,index) in lists" :key="index">
<view class="right">
<view class="item" style="justify-content: flex-start;">
<text class="rest">余额提现至</text>
<text v-if="item.merchant_bank_info.bank_code"
class="code">({{item.merchant_bank_info.bank_code.substring(item.merchant_bank_info.bank_code.length - 4)}})</text>
<text class="withdraw-type legal_company">{{ item.merchant_bank_info.is_own?"对公" :"个人"}}</text>
</view>
<view class="item">
<view class="item_title">
<text>{{item.merchant_bank_info.bank_info.name }}</text>
</view>
<view class="item_money">+{{item.amount}}</view>
</view>
<view class="item">
<view class="item-time">{{item.create_time}}</view>
{{item.is_check==1?'审核通过':item.is_check==2?"审核不通过":"待审核" }}
</view>
</view>
<view class="remark" v-if="item.fail_msg">{{item.fail_msg}}</view>
</view>
</view>
<up-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
<u-datetime-picker :show="showDate" @confirm='confirmDate' :maxDate='now' @cancel='showDate=false'
@close='showDate=false' v-model="nowTimes" mode="year-month"></u-datetime-picker>
</view>
</template>
<script>
export default {
data() {
return {
keyword: '',
total: "",
count: "",
nowTimes: '',
now: new Date().getTime(),
showDate: false,
lists: [{
"id": 11,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 297,
"amount": "80.00",
"is_check": 0,
"fail_msg": "",
"is_arrival": 0,
"arrival_proof": null,
"create_time": "2024-05-15 10:56:43",
"merchant_bank_info": {
"id": 297,
"supplier_id": 0,
"mer_id": 500,
"bank_id": 1,
"bank_code": "6213362109985515778",
"bank_branch": "迎晖路支行",
"name": "赵明军",
"id_card": "513701200012105613",
"phone": "19130550023",
"financial_img": "",
"is_own": 0,
"is_check": 1,
"fail_msg": null,
"admin_id": 1,
"create_time": "2024-05-14 16:49:31",
"update_time": "2024-05-14 16:50:04",
"delete_time": null,
"bank_info": {
"id": 1,
"name": "中国银行",
"image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png",
"create_time": 0,
"update_time": 0,
"delete_time": null
}
}
},
{
"id": 10,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 297,
"amount": "58.00",
"is_check": 0,
"fail_msg": "",
"is_arrival": 0,
"arrival_proof": null,
"create_time": "2024-05-15 10:55:34",
"merchant_bank_info": {
"id": 297,
"supplier_id": 0,
"mer_id": 500,
"bank_id": 1,
"bank_code": "6213362109985515778",
"bank_branch": "迎晖路支行",
"name": "赵明军",
"id_card": "513701200012105613",
"phone": "19130550023",
"financial_img": "",
"is_own": 0,
"is_check": 1,
"fail_msg": null,
"admin_id": 1,
"create_time": "2024-05-14 16:49:31",
"update_time": "2024-05-14 16:50:04",
"delete_time": null,
"bank_info": {
"id": 1,
"name": "中国银行",
"image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png",
"create_time": 0,
"update_time": 0,
"delete_time": null
}
}
},
{
"id": 9,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 297,
"amount": "7.00",
"is_check": 1,
"fail_msg": "",
"is_arrival": 1,
"arrival_proof": "[\"https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240514/20240514112247c16164097.png\", \"https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240514/202405141122478b56c8734.png\", \"https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240514/20240514112247e80105959.png\"]",
"create_time": "2024-05-14 21:54:14",
"merchant_bank_info": {
"id": 297,
"supplier_id": 0,
"mer_id": 500,
"bank_id": 1,
"bank_code": "6213362109985515778",
"bank_branch": "迎晖路支行",
"name": "赵明军",
"id_card": "513701200012105613",
"phone": "19130550023",
"financial_img": "",
"is_own": 0,
"is_check": 1,
"fail_msg": null,
"admin_id": 1,
"create_time": "2024-05-14 16:49:31",
"update_time": "2024-05-14 16:50:04",
"delete_time": null,
"bank_info": {
"id": 1,
"name": "中国银行",
"image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png",
"create_time": 0,
"update_time": 0,
"delete_time": null
}
}
},
{
"id": 7,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 297,
"amount": "12.00",
"is_check": 1,
"fail_msg": "",
"is_arrival": 1,
"arrival_proof": "[\"https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240514/202405141811330f05a4138.png\", \"https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240514/2024051411224760ab52438.png\"]",
"create_time": "2024-05-14 18:20:12",
"merchant_bank_info": {
"id": 297,
"supplier_id": 0,
"mer_id": 500,
"bank_id": 1,
"bank_code": "6213362109985515778",
"bank_branch": "迎晖路支行",
"name": "赵明军",
"id_card": "513701200012105613",
"phone": "19130550023",
"financial_img": "",
"is_own": 0,
"is_check": 1,
"fail_msg": null,
"admin_id": 1,
"create_time": "2024-05-14 16:49:31",
"update_time": "2024-05-14 16:50:04",
"delete_time": null,
"bank_info": {
"id": 1,
"name": "中国银行",
"image": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240510/20240510114142858ca3838.png",
"create_time": 0,
"update_time": 0,
"delete_time": null
}
}
},
{
"id": 4,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 296,
"amount": "100.00",
"is_check": 1,
"fail_msg": "",
"is_arrival": 0,
"arrival_proof": null,
"create_time": "2024-05-14 17:04:13",
"merchant_bank_info": {
"bank_info": "[]"
}
},
{
"id": 3,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 296,
"amount": "100.00",
"is_check": 0,
"fail_msg": "",
"is_arrival": 0,
"arrival_proof": null,
"create_time": "2024-05-14 17:02:59",
"merchant_bank_info": {
"bank_info": "[]"
}
},
{
"id": 2,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 296,
"amount": "100.00",
"is_check": 0,
"fail_msg": "",
"is_arrival": 0,
"arrival_proof": null,
"create_time": "2024-05-14 15:51:02",
"merchant_bank_info": {
"bank_info": "[]"
}
},
{
"id": 1,
"mer_id": 500,
"supplier_id": 0,
"merchant_bank_id": 296,
"amount": "100.00",
"is_check": 0,
"fail_msg": "",
"is_arrival": 0,
"arrival_proof": null,
"create_time": "2024-05-14 14:35:47",
"merchant_bank_info": {
"bank_info": "[]"
}
}
]
}
},
methods: {
navgo(url) {
uni.navigateTo({
url
})
},
formatTimestampToYearMonth(timestamp) {
var date = new Date(timestamp);
var year = date.getFullYear();
var month = date.getMonth() + 1; // 01
if (month < 10) {
month = '0' + month; // 10
}
return year + '-' + month;
}
},
onLoad() {
uni.showTabBar()
}
}
</script>
<style scoped lang="scss">
.content {
padding: 20rpx;
.head {
padding: 28rpx;
background-color: #fff;
border-radius: 24rpx;
box-shadow: 0rpx 4rpx 10rpx 2rpx rgba(161, 161, 161, 0.4);
border-radius: 20rpx 20rpx 20rpx 20rpx;
.head_conent {
display: flex;
justify-content: space-around;
align-items: center;
.line {
width: 1rpx;
height: 70rpx;
background-color: #dfdfdf;
}
.sum {
flex: 1;
text-align: center;
color: #737373;
font-size: 30rpx;
.num {
font-size: 48.06rpx;
margin-bottom: 15rpx;
font-weight: bold;
}
.text {
margin-bottom: 24rpx;
font-size: 28rpx;
color: #666666;
}
}
}
}
}
.recoder {
margin-top: 20rpx;
// padding: 0 28rpx 28rpx 28rpx;
.time {
height: 42rpx;
font-size: 30rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #333333;
line-height: 45rpx;
margin-bottom: 20rpx;
display: flex;
align-items: center;
.icon {
width: 30rpx;
height: 30rpx;
transform: rotate(90deg);
margin-left: 10rpx;
}
}
.card {
// width: 694rpx;
background: #FFFFFF;
border-radius: 21rpx 21rpx 21rpx 21rpx;
opacity: 1;
padding: 28rpx;
margin-bottom: 20rpx;
.right {
flex: 1;
.item {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.rest {
margin-right: 10rpx;
font-size: 28rpx;
color: #333333;
}
.code {
margin-right: 10rpx;
font-weight: 600;
font-size: 28rpx;
color: #333333;
}
.legal_company {
font-size: 24rpx;
color: #FFFFFF;
background: #72BE53;
border-radius: 6rpx;
padding: 2rpx 10rpx;
}
.legal_person {
font-size: 24rpx;
color: #FFFFFF;
background: #FF8056;
border-radius: 6rpx;
padding: 2rpx 10rpx;
}
.item-time {
font-size: 28rpx;
color: #666666;
}
&_title {
font-weight: 600;
font-size: 28rpx;
color: #333333;
}
&_money {
font-weight: 600;
font-size: 36rpx;
color: #F55726;
}
&_brank {
font-size: 26rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #737373;
line-height: 39rpx;
}
&_time {
font-size: 23rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #B3B3B3;
line-height: 34rpx;
}
.item_status {
border-radius: 6rpx 6rpx 6rpx 6rpx;
padding: 2rpx 16rpx;
font-size: 28rpx;
}
.audit {
background: rgba(38, 172, 245, .2);
color: #26ACF5;
}
.trans {
background: rgba(245, 87, 38, .2);
color: #F55726;
}
.done {
display: flex;
background: rgba(70, 176, 58, .2);
color: #46B03A;
}
.lose {
background: rgba(102, 102, 102, .2);
color: #666;
}
}
.item-title {
justify-content: flex-start;
text {
&:nth-child(1) {
width: 198rpx;
height: 40rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #333333;
line-height: 51rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
&:nth-child(1) {
width: 198rpx;
height: 40rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #333333;
line-height: 51rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
}
}
}
.remark {
word-wrap: break-word;
font-size: 24rpx;
color: #F55726;
font-weight: bold;
}
}
}
</style>

672
pages/quote/index.vue Normal file
View File

@ -0,0 +1,672 @@
<template>
<view style="padding: 100rpx 0;">
<view class="head">
<view class="">
<view class="" style="display: flex;justify-content: space-around;margin-top: 24rpx;color:#777777">
<view :class="{act: tabIndex==1}" @click="changeTabs(1)">
报价列表
</view>
<view :class="{act: tabIndex==2}" @click="changeTabs(2)">
报价记录{{tabIndex}}
</view>
</view>
<view style="height: 8rpx;" />
<view class="line" :style="{left:tabIndex==1?tabsLeft+'px':tabsRight+'px'}" />
</view>
</view>
<view class="content">
<u-loading-page v-if="loading" :loading="loading"></u-loading-page>
<view v-else>
<view class="card" v-for="(item,index) in lists" :key='index'>
<view class="head">
</view>
<view class="card-content">
<view class="card-content-l" style="width: 152rpx;height: 152rpx;">
<image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode=""></image>
<view class="status">
{{tabIndex==1?"未报价":"已报价" }}
</view>
</view>
<view class="card-content-r">
<view class="title ellipsis">
{{item.goods.name}}
</view>
<view class="need">
需求量 {{item.need_num}}{{item.unit_name}}
</view>
<view class="ipt">
<u--input placeholder="输入报价数量" :readonly="tabIndex==2" v-model="item.nums"
style="background-color:#F6F6F6;border: none;"></u--input>
<view style="width: 10rpx;">
</view>
<u--input style="background-color: #F6F6F6;border: none;" placeholder="输入产品报价"
@blur="priceBlur(index)" :readonly="tabIndex==2" v-model="item.price"></u--input>
</view>
</view>
</view>
<view class="card-footer" v-if="item.nums && item.price">
{{item.nums}}{{item.unit_name}}&nbsp; &nbsp;合计:<text
style="font-size: 28rpx;color: #FC452F;font-weight: 700;">{{(item.nums*item.price).toFixed(2)}}</text>
</view>
<u-line style="margin-top: 30rpx;" color="#F3F3F3"></u-line>
</view>
</view>
<!-- <up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty> -->
<!-- <view class="detail" @click="navgo('/pageQuota/Balance/index')">
提现
</view> -->
<view class="submit-btn" v-if="tabIndex==1">
<u-button shape='circle' color='#20B128' @click="submit" text="提交"></u-button>
</view>
</view>
</view>
</template>
<script>
import {
OpurchaseGoodsOfferListApi
} from "@/api/supplier.js"
export default {
data() {
return {
tabIndex: 1,
tabsLeft: 0,
tabsRight: 0,
loading: false,
lists: [{
"id": 15,
"supplier_id": 9,
"order_id": 2,
"goods_id": 113,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 400,
"is_adopt_text": "待报价",
"goods": {
"id": 113,
"name": "火龙果花",
"py": "",
"sys_labels": [
"497"
],
"number": "",
"spec": "富含维生素C、钙、磷、铁等营养成分",
"class": 497,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/202405151405465afc55555.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 14:05:52",
"update_time": "2024-05-15 14:05:52",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 14,
"supplier_id": 9,
"order_id": 2,
"goods_id": 112,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 300,
"is_adopt_text": "待报价",
"goods": {
"id": 112,
"name": "蛇皮果",
"py": "",
"sys_labels": [
"120"
],
"number": "",
"spec": "富含维生素C、B族维生素",
"class": 120,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/20240515135546c2f251314.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 13:55:49",
"update_time": "2024-05-15 13:55:49",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 13,
"supplier_id": 9,
"order_id": 2,
"goods_id": 111,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 200,
"is_adopt_text": "待报价",
"goods": {
"id": 111,
"name": "红参果",
"py": "",
"sys_labels": [
"121"
],
"number": "",
"spec": "质地柔软丨口感清甜",
"class": 121,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/202405151353132038a8389.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 13:53:16",
"update_time": "2024-05-15 13:53:16",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 12,
"supplier_id": 9,
"order_id": 2,
"goods_id": 110,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 100,
"is_adopt_text": "待报价",
"goods": {
"id": 110,
"name": "仁面果",
"py": "",
"sys_labels": [
"122"
],
"number": "",
"spec": "口感丰富丨果汁丰富",
"class": 122,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/202405151349268542d3786.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 13:51:06",
"update_time": "2024-05-15 13:51:06",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 15,
"supplier_id": 9,
"order_id": 2,
"goods_id": 113,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 400,
"is_adopt_text": "待报价",
"goods": {
"id": 113,
"name": "火龙果花",
"py": "",
"sys_labels": [
"497"
],
"number": "",
"spec": "富含维生素C、钙、磷、铁等营养成分",
"class": 497,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/202405151405465afc55555.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 14:05:52",
"update_time": "2024-05-15 14:05:52",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 14,
"supplier_id": 9,
"order_id": 2,
"goods_id": 112,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 300,
"is_adopt_text": "待报价",
"goods": {
"id": 112,
"name": "蛇皮果",
"py": "",
"sys_labels": [
"120"
],
"number": "",
"spec": "富含维生素C、B族维生素",
"class": 120,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/20240515135546c2f251314.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 13:55:49",
"update_time": "2024-05-15 13:55:49",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 13,
"supplier_id": 9,
"order_id": 2,
"goods_id": 111,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 200,
"is_adopt_text": "待报价",
"goods": {
"id": 111,
"name": "红参果",
"py": "",
"sys_labels": [
"121"
],
"number": "",
"spec": "质地柔软丨口感清甜",
"class": 121,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/202405151353132038a8389.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 13:53:16",
"update_time": "2024-05-15 13:53:16",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
},
{
"id": 12,
"supplier_id": 9,
"order_id": 2,
"goods_id": 110,
"price": "",
"nums": '',
"unit": null,
"is_adopt": 0,
"is_storage": 0,
"create_time": 0,
"update_time": 0,
"delete_time": null,
"need_num": 0,
"notes": null,
"before_nums": 100,
"is_adopt_text": "待报价",
"goods": {
"id": 110,
"name": "仁面果",
"py": "",
"sys_labels": [
"122"
],
"number": "",
"spec": "口感丰富丨果汁丰富",
"class": 122,
"brand": 0,
"unit": 2,
"buy": "0.02",
"sell": "0.01",
"retail": "0.00",
"code": "",
"warehouse": 1,
"location": "",
"stocktip": "100.00",
"sales": 0,
"tax_rate": null,
"imgs": "https://lihaiim.oss-cn-chengdu.aliyuncs.com/public/uploads/images/20240515/202405151349268542d3786.png",
"details": [
""
],
"data": "",
"more": "",
"create_time": "2024-05-15 13:51:06",
"update_time": "2024-05-15 13:51:06",
"delete_time": null,
"sort": 0,
"unit_name": "斤"
}
}
]
}
},
methods: {
getTabsPosi() {
const {
windowWidth
} = uni.getSystemInfoSync();
this.tabsLeft = (((windowWidth / 2) - 26) / 2)
this.tabsRight = (this.tabsLeft + (windowWidth / 2))
},
async getLists() {
let that = this
// that.loading = true
// let res = await getLists({})
// this.lists = res.lists
// that.loading = false
that.loading = true
setTimeout(() => {
that.loading = false
}, 1000)
},
changeTabs(num) {
let that = this
this.tabIndex = num
this.getLists()
},
priceBlur(i) {
this.lists[i].price = (+this.lists[i].price).toFixed(2)
},
async submit() {
let data =
this.lists.filter(item => {
return (+item.price && +item.nums)
}).map(item => {
return {
id: item.id,
nums: item.nums,
price: item.price
}
})
if (!data.length) return
this.getLists(2)
return
let res = await submitApi({
...data
})
this.getLists(2)
}
},
onLoad() {
this.getTabsPosi()
this.getLists()
OpurchaseGoodsOfferListApi()
}
}
</script>
<style lang="scss">
.head {
padding: 20rpx;
background-color: white;
position: relative;
position: fixed;
top: 0;
width: 100vw;
z-index: 10;
.act {
color: #20B128;
}
.line {
width: 26px;
height: 5rpx;
background-color: #20B128;
border-radius: 50rpx;
position: absolute;
transition: 300ms;
}
}
.content {
padding: 20rpx;
padding-bottom: 150rpx;
.card {
width: 710rpx;
margin: 0 auto;
padding: 20rpx;
box-sizing: border-box;
background-color: white;
.card-content {
display: flex;
position: relative;
.card-content-l {
margin-right: 20rpx;
position: relative;
.status {
width: 152rpx;
height: 40rpx;
background-color: rgba(0, 0, 0, .3);
text-align: center;
color: white;
font-size: 24rpx;
line-height: 40rpx;
position: absolute;
bottom: 0;
}
}
.card-content-r {
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
font-size: 30rpx;
width: 500rpx;
}
.need {
color: #777777;
font-size: 24rpx;
}
.ipt {
display: flex;
height: 56rpx;
}
}
.status-png {
position: absolute;
right: 20rpx;
}
}
.card-footer {
margin-top: 30rpx;
text-align: right;
font-size: 28rpx;
color: #060606;
}
}
.submit-btn {
position: fixed;
bottom: 70rpx;
width: 710rpx;
margin: 0 auto;
}
}
.detail {
width: 88rpx;
height: 88rpx;
border-radius: 88rpx;
text-align: center;
line-height: 88rpx;
background-color: #50C758;
color: white;
position: absolute;
bottom: 30px;
// right: 20rpx;
}
.ellipsis {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>

11
pages/quote/list.vue Normal file
View File

@ -0,0 +1,11 @@
<template>
<view class="">
list
</view>
</template>
<script>
</script>
<style>
</style>

View File

@ -0,0 +1,212 @@
<template>
<view class="content">
<view class="total">
<view class="">
账户总余额()
</view>
<view style="font-size: 36rpx;">
{{balance||0.00}}
</view>
</view>
<view class="action">
<view class="">
提现至
</view>
<view style="font-weight: bold;" @click="showPop1=true">
{{target_bank.is_own?'对公账户':"个人账户"}}
</view>
<view style="display: flex;align-items: center;color: #20B128;" @click="navgo('/pages/quote/bindAccout')">
<text>更换账户</text> <u-icon color="#20B128" name="arrow-right"></u-icon>
</view>
</view>
<view class="form" v-if='target_bank.bank_name'>
<u-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" ref="form1" labelWidth='70'>
<u-form-item label="银行卡" borderBottom ref="item1">
<u-input style="border: none;" v-model="target_bank.bank_name" />
</u-form-item>
<u-form-item label="持卡人" borderBottom ref="item1">
<u-input style="border: none;" v-model="target_bank.name" />
</u-form-item>
<u-form-item label="银行账户" borderBottom ref="item1">
<u-input style="border: none;" v-model="target_bank.bank_code" />
</u-form-item>
<u-form-item label="开户网点" borderBottom ref="item1">
<u-input style="border: none;" v-model="target_bank.bank_branch" />
</u-form-item>
<u-form-item label="提现金额" borderBottom ref="item1">
<u-input style="border: none;" v-model="form.money" placeholder="请输入提现金额" />
</u-form-item>
<text style="color: #999999;font-size: 24rpx;">
说明:用户下单后该订单金额存放在暂存金额中用户确认收货后次日18:00才可提现该笔订单金额
提货付款订单在完成后次日18:00才可提现
</text>
</u-form>
</view>
<u-empty mode="data" v-else :text='emptyText'
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/89e93202405131146497294.png" />
<view class="detail" @click="navgo('/pages/quote/financialyDeatil')">
明细
</view>
<view class="submit-btn">
<u-button text="提现" @click="submit" shape="circle" color="#50C758"></u-button>
</view>
<u-popup :show="showPop1" :round="10" mode="bottom" @close="showPop1=false" @open="showPop1=true">
<view class="popContent">
<view style="text-align: center;font-weight: bold;">请选择提现账户</view>
<u-icon name="close" color="#303133" size="24" @click="showPop1=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></u-icon>
<view class="bank-list">
<view class="bank-li" @click="choseAccount(0)">
<text>个人账户</text>
</view>
<view class="bank-li" @click="choseAccount(1)">
<text>对公账户</text>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script>
import {
hasBindAccount
} from "@/api/supplier.js"
export default {
data() {
return {
balance: '',
target_bank: {},
emptyText: "撒大声地",
form: {
money: ''
},
showPop1: false,
}
},
methods: {
navgo(url) {
uni.navigateTo({
url
})
},
choseAccount(type) {
this.target_bank = this.hasBindAccount[type] || {}
this.showPop1 = false
},
async getHasBindBankList() {
this.target_bankhasBindAccountt[0]
return
let res = await amountAccountApi({})
this.balance = res.data.balance
this.hasBindAccount = res.data.hasBindAccount
this.target_bank = res.data.hasBindAccount[0] || {}
},
async submit() {
console.log({
"merchant_bank_id": this.target_bank.id,
"amount": this.form.money
})
return
await UserWithdrawApi({
"merchant_bank_id": this.target_bank.id,
"amount": this.form.money
})
uni.showToast({
title: '提交成功',
duration: 1500,
})
uni.$u.sleep(1500).then(res => {
uni.navigateTo({
url: '/pages/quote/financialyDeatil'
})
})
}
},
onLoad() {
uni.showTabBar()
this.getHasBindBankList()
}
}
</script>
<style lang="scss">
.content {
padding: 20rpx;
min-height: 100vh;
.total {
background-color: #50C758;
border-radius: 16rpx 16rpx 16rpx 16rpx;
color: white;
display: flex;
justify-content: space-between;
padding: 42rpx 30rpx;
font-size: 30rpx;
margin-bottom: 30rpx;
}
.action {
background-color: white;
border-radius: 16rpx 16rpx 16rpx 16rpx;
padding: 30rpx;
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
}
.form {
padding: 28rpx 30rpx;
background-color: white;
border-radius: 20rpx;
}
}
.popContent {
padding: 20rpx;
.bank-list {
overflow-y: auto;
position: relative;
max-height: 40vh;
.bank-li {
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx;
border-bottom: 1px solid #F8F9FA;
}
}
}
.detail {
width: 88rpx;
height: 88rpx;
border-radius: 88rpx;
text-align: center;
line-height: 88rpx;
background-color: #50C758;
color: white;
position: absolute;
bottom: 300rpx;
right: 20rpx;
}
.submit-btn {
position: fixed;
bottom: 146rpx;
width: 710rpx;
}
</style>

View File

@ -9,13 +9,17 @@
// +----------------------------------------------------------------------
import {
HTTP_REQUEST_URL,
HTTP_REQUEST_URL_TWO,
HEADER,
TOKENNAME
} from '@/config/app';
import { checkLogin } from '../libs/login';
import {
checkLogin
} from '../libs/login';
import store from '../store';
import pako from '../plugin/pako/pako.es5.min.js'
function toLogin(){
function toLogin() {
store.commit("LOGOUT");
uni.showToast({
title: '请登录',
@ -23,40 +27,43 @@ function toLogin(){
duration: 1000
});
}
function decompress(str) {
return pako.inflateRaw(base64ToUint8Array(str), {
to: 'string'
});
}
function base64ToUint8Array(base64String) {
let padding = '='.repeat((4 - base64String.length % 4) % 4);
let base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');
let rawData = atob(base64);
let outputArray = new Uint8Array(rawData.length);
for (var i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
let padding = '='.repeat((4 - base64String.length % 4) % 4);
let base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');
let rawData = atob(base64);
let outputArray = new Uint8Array(rawData.length);
for (var i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
function atob(input) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let str = input.replace(/=+$/, '');
let output = '';
if (str.length % 4 === 1) {
throw new Error('InvalidLengthError');
}
for (let i = 0, len = str.length; i < len; i += 4) {
const a = chars.indexOf(str.charAt(i));
const b = chars.indexOf(str.charAt(i + 1));
const c = chars.indexOf(str.charAt(i + 2));
const d = chars.indexOf(str.charAt(i + 3));
const sum = (a << 18) | (b << 12) | (c << 6) | d;
output += String.fromCharCode((sum >> 16) & 0xFF, (sum >> 8) & 0xFF, sum & 0xFF);
}
return output;
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let str = input.replace(/=+$/, '');
let output = '';
if (str.length % 4 === 1) {
throw new Error('InvalidLengthError');
}
for (let i = 0, len = str.length; i < len; i += 4) {
const a = chars.indexOf(str.charAt(i));
const b = chars.indexOf(str.charAt(i + 1));
const c = chars.indexOf(str.charAt(i + 2));
const d = chars.indexOf(str.charAt(i + 3));
const sum = (a << 18) | (b << 12) | (c << 6) | d;
output += String.fromCharCode((sum >> 16) & 0xFF, (sum >> 8) & 0xFF, sum & 0xFF);
}
return output;
}
var HTTP_list = new Map();
@ -67,7 +74,7 @@ var HTTP_list = new Map();
function baseRequest(url, method, data, {
noAuth = false,
noVerify = false,
enLoad = false //终止上一个接口相同类型正在请求的接口, 防止快速切换tab时页面抖动
enLoad = false //终止上一个接口相同类型正在请求的接口, 防止快速切换tab时页面抖动
}) {
let Url = HTTP_REQUEST_URL,
header = HEADER;
@ -80,16 +87,16 @@ function baseRequest(url, method, data, {
});
}
}
let URL = Url + '/api/' + url
if(enLoad) {
let http = HTTP_list.get(URL);
if(http){
http.abort();
}
}
HTTP_list.delete(URL);
let URL = Url + '/api/' + url
if (enLoad) {
let http = HTTP_list.get(URL);
if (http) {
http.abort();
}
}
HTTP_list.delete(URL);
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
if(store.state.app.uuid) header['uuid'] = store.state.app.uuid
if (store.state.app.uuid) header['uuid'] = store.state.app.uuid
return new Promise((reslove, reject) => {
let http = uni.request({
url: URL,
@ -98,10 +105,9 @@ function baseRequest(url, method, data, {
data: data || {},
success: (res) => {
if (res.data && res.data.encode) {
try
{
try {
res.data = JSON.parse(decompress(res.data.data));
}catch(e){
} catch (e) {
res.data = decompress(decodeURI(res.data.data));
}
}
@ -118,22 +124,22 @@ function baseRequest(url, method, data, {
})
reject(res.data);
} else {
console.error("请求失败", res)
reject(res.data.message || '系统错误');
}
console.error("请求失败", res)
reject(res.data.message || '系统错误');
}
},
fail: (message) => {
reject('请求失败');
},
complete: () => {
// if(enLoad) HTTP_list.delete(URL);
}
complete: () => {
// if(enLoad) HTTP_list.delete(URL);
}
})
if(enLoad) HTTP_list.set(URL, http);
if (enLoad) HTTP_list.set(URL, http);
});
}
const request = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
request[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
});
export default request;
export default request;

134
utils/requestSupplier.js Normal file
View File

@ -0,0 +1,134 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
HTTP_REQUEST_URL_TWO,
HEADER,
} from '@/config/app';
import {
checkLogin
} from '../libs/login';
import store from '../store';
import pako from '../plugin/pako/pako.es5.min.js'
let TOKENNAME = 'Token'
function toLogin() {
}
console.log(HTTP_REQUEST_URL_TWO, 'HTTP_REQUEST_URL_TWO')
function decompress(str) {
return pako.inflateRaw(base64ToUint8Array(str), {
to: 'string'
});
}
function base64ToUint8Array(base64String) {
let padding = '='.repeat((4 - base64String.length % 4) % 4);
let base64 = (base64String + padding)
.replace(/\-/g, '+')
.replace(/_/g, '/');
let rawData = atob(base64);
let outputArray = new Uint8Array(rawData.length);
for (var i = 0; i < rawData.length; ++i) {
outputArray[i] = rawData.charCodeAt(i);
}
return outputArray;
}
function atob(input) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
let str = input.replace(/=+$/, '');
let output = '';
if (str.length % 4 === 1) {
throw new Error('InvalidLengthError');
}
for (let i = 0, len = str.length; i < len; i += 4) {
const a = chars.indexOf(str.charAt(i));
const b = chars.indexOf(str.charAt(i + 1));
const c = chars.indexOf(str.charAt(i + 2));
const d = chars.indexOf(str.charAt(i + 3));
const sum = (a << 18) | (b << 12) | (c << 6) | d;
output += String.fromCharCode((sum >> 16) & 0xFF, (sum >> 8) & 0xFF, sum & 0xFF);
}
return output;
}
var HTTP_list = new Map();
/**
* 发送请求
*/
function baseRequest(url, method, data, {
noAuth = false,
noVerify = false,
enLoad = false //终止上一个接口相同类型正在请求的接口, 防止快速切换tab时页面抖动
}) {
let Url = HTTP_REQUEST_URL_TWO,
header = HEADER;
let URL = Url + '/api/' + url
if (enLoad) {
let http = HTTP_list.get(URL);
if (http) {
http.abort();
}
}
HTTP_list.delete(URL);
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
if (store.state.app.uuid) header['uuid'] = store.state.app.uuid
return new Promise((reslove, reject) => {
let http = uni.request({
url: URL,
method: method || 'GET',
header: header,
data: data || {},
success: (res) => {
if (res.data && res.data.encode) {
try {
res.data = JSON.parse(decompress(res.data.data));
} catch (e) {
res.data = decompress(decodeURI(res.data.data));
}
}
if (noVerify)
reslove(res.data, res);
else if (res.data.status == 200)
reslove(res.data, res);
else if ([410000, 410001, 410002, 40000].indexOf(res.data.status) !== -1) {
toLogin();
reject(res.data);
} else if (res.data.status == 501) {
uni.reLaunch({
url: '/pages/error/index'
})
reject(res.data);
} else {
console.error("请求失败", res)
reject(res.data.message || '系统错误');
}
},
fail: (message) => {
reject('请求失败');
},
complete: () => {
// if(enLoad) HTTP_list.delete(URL);
}
})
if (enLoad) HTTP_list.set(URL, http);
});
}
const request = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
request[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
});
export default request;