This commit is contained in:
zmj 2024-05-13 18:05:23 +08:00
parent 4d63fca8fb
commit b3d0a15245
17 changed files with 2287 additions and 706 deletions

17
api/balance.js Normal file
View File

@ -0,0 +1,17 @@
import request from '@/utils/request';
//报价单列表
export const bindCradApi = (data) => {
return request.post('/merchant/merchant/add_bank', data);
}
//报价单提交
export const bankListApi = (data) => {
return request.get('/bank/bank/lists', data);
}
// //报价单提交
// export const aboutUsApi = (data) => {
// return request.post('/operation/OpurchaseGoodsOffer/offer', data);
// }

View File

@ -0,0 +1,54 @@
## 1.2.62024-04-15
ui调整
## 1.2.52023-12-08
bug修复
## 1.2.42023-12-08
新增上午下午选择
## 1.2.32023-08-30
nvue样式异常修复
## 1.2.22023-08-30
bug修复
## 1.2.12023-08-30
微信小程序端默认时间初始化问题修复
## 1.2.02023-08-28
bug修复
## 1.1.92023-08-15
bug修改
## 1.1.82023-08-15
bug修复
## 1.1.72023-08-01
bug修复
## 1.1.62023-08-01
bug修复
## 1.1.52023-07-31
修复已知bug
## 1.1.42023-07-28
bug修复
## 1.1.32023-07-11
bug修复
## 1.1.22023-07-11
bug修复
## 1.1.12023-07-05
修复年月切换后日不更新bug
## 1.1.02023-06-20
修复mode初始化问题
## 1.0.102023-05-18
样式优化
## 1.0.92023-05-18
补充效果图
## 1.0.82023-05-18
文档说明调整
## 1.0.72023-05-18
新增选择器显示模式
## 1.0.62023-05-18
h5端样式问题修复
## 1.0.52023-05-16
细节优化
## 1.0.32023-05-16
细节优化
## 1.0.22023-05-12
bug修复
## 1.0.12023-05-12
修复已知问题
## 1.0.02023-05-12
1.0.0

View File

@ -0,0 +1,666 @@
<template>
<view>
<uni-popup ref="popup" @maskClick="close">
<view class="popup-box">
<view class="title">
<view class="tabs-box" v-if="mode=='all'">
<view v-for="(item,index) in tabs" :key="index" class="tabs-item" @click="tabChange(index)"
:class="{'tabs-check':index==tabIndex}">
<text class="item-text">{{item}}</text>
</view>
</view>
<view v-else class="title-text">
<text class="text">{{title?title:mode=='multiple'?'日期筛选':'月份选择'}}</text>
</view>
<uni-icons type="closeempty" class="close" size="16" @click="close"></uni-icons>
</view>
<view class="options-box" v-if="tabIndex">
<view class="flex row-between" style="width: 670rpx;">
<view v-for="(item,index) in options" :key="index" class="option" @click="optionSelect(index)"
:class="{'option-check':opIndex==index}">
<text class="option-text">{{item}}</text>
</view>
</view>
<view class="flex row-between" style="margin-top: 40rpx;width: 670rpx;">
<view class="option" :class="{'option-check':op1Index==0}"
style="width: 320rpx;padding-left: 0;padding-right: 0;" @click="optionChange(0)">
<text class="option-text">{{startDate}}</text>
</view>
<view style="width: 18rpx;height: 2rpx;background: #7B8686;"></view>
<view class="option" :class="{'option-check':op1Index==1}"
style="width: 320rpx;padding-left: 0;padding-right: 0;" @click="optionChange(1)">
<text class="option-text">{{endDate}}</text>
</view>
</view>
</view>
<view class="picker-body">
<picker-view class="picker-view" :style="{height:tabIndex ? '380rpx' : '660rpx'}"
indicator-style="height:38px;background: rgba(0,0,0,.03);border:none;" :value="valueArr"
@change="change" @touchend="touchend">
<picker-view-column v-if="params.year">
<view class="column-item" v-for="(item,index) in years" :key="index">
<text class="column-item-text">{{item}}</text>
</view>
</picker-view-column>
<picker-view-column v-if="params.month">
<view class="column-item" v-for="(item,index) in months" :key="index">
<text class="column-item-text">{{formatNumber(item)}}</text>
</view>
</picker-view-column>
<picker-view-column v-if="params.day">
<view class="column-item" v-for="(item,index) in days" :key="index">
<text class="column-item-text">{{formatNumber(item)}}</text>
</view>
</picker-view-column>
<picker-view-column v-if="params.half">
<view class="column-item" v-for="(item,index) in halfs" :key="index">
<text class="column-item-text">{{item.label}}</text>
</view>
</picker-view-column>
</picker-view>
</view>
<view class="bottom">
<view class="h-btn h-btn-line" @click="reset">
<text style="color: #333;font-size: 32rpx;">重置</text>
</view>
<view class="h-btn" @click="getResult">
<text style="color: #fff;font-size: 32rpx;">确定</text>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import timeFormat from "../../js/timeFormat.js"
export default {
props: {
// picker
params: {
type: Object,
default () {
return {
year: true,
month: true,
day: true,
half: false
};
}
},
// 2025-07-02 || 2025-07-02 13:01:00 || 2025/07/02
defaultTime: {
type: String,
default: timeFormat(new Date(), 'yyyy-mm-dd')
},
// month: day:
optionMode: {
type: String,
default: 'month'
},
// single: multiple: all:(bug )
mode: {
type: String,
default: 'all'
},
endTime: {
type: String,
default: timeFormat(new Date(), 'yyyy-mm-dd')
},
state: {
type: Number,
default: 1 //1. 2
},
title: {
type: String,
default: ''
}
},
data() {
return {
timeFormat,
years: [],
months: [],
days: [],
halfs: [{
label: '上午',
value: 1
}, {
label: '下午',
value: 2
}],
valueArr: [],
yearKey: 0,
monthKey: 0,
dayKey: 0,
halfKey: 0,
date: '',
startDate: '',
endDate: '',
time: {},
end_time: {},
tabs: ['选择时间', '自定义时间'],
tabIndex: 0,
opIndex: -1,
op1Index: 0,
options: ['近三月', '近半年', '近一年'],
fmt: 'yyyy-mm-dd',
isClick: false,
}
},
mounted() {
this.init()
// this.valueArr = [this.getIndex(this.years, this.time.year), this.getIndex(this.months, this.time.month), this
// .days.length
// ]
},
watch: {
'time.year'(val, oval) {
if (this.params.month && oval) {
this.setMonths()
// this.setDays()
}
if (this.params.day && oval) {
this.setDays()
}
},
'time.month'(val, oval) {
if (this.params.day && oval) {
this.setDays()
}
}
},
methods: {
init(recieve_time) {
this.valueArr = [];
// this.tabIndex = this.mode == 'multiple' ? 1 : 0
//
this.time = this.initTimeValue(this.defaultTime);
if (recieve_time) {
this.time = this.initTimeValue(recieve_time.time)
}
//
this.end_time = this.initTimeValue(this.endTime);
let fmt = []
if (this.optionMode == 'day') {
this.options = ['近3天', '近7天', '近15天']
}
if (this.params.year) {
this.valueArr.push(0);
this.yearKey = this.valueArr.length - 1
this.setYears();
fmt.push('yyyy')
}
if (this.params.month) {
this.valueArr.push(0);
this.monthKey = this.valueArr.length - 1
this.setMonths();
fmt.push('mm')
}
if (this.params.day) {
this.valueArr.push(0);
this.dayKey = this.valueArr.length - 1
this.setDays();
fmt.push('dd')
}
if (this.params.half) {
let half_index = 0
if (recieve_time) {
half_index = recieve_time.half == 1 ? 0 : 1
}
this.valueArr.push(half_index);
this.halfKey = this.valueArr.length - 1
}
this.fmt = fmt.join('-')
//
this.date = this.startDate = this.endDate = this.timeFormat(new Date(this.defaultTime.replace(/\-/g, '/')),
this.fmt)
if (recieve_time) {
this.date = this.startDate = this.endDate = this.timeFormat(new Date(recieve_time.time.replace(/\-/g,
'/')),
this.fmt)
}
this.valueArr = [this.getIndex(this.years, this.time.year), this.getIndex(this.months, this.time.month),
this
.days.length
]
//console.log(this.valueArr);
},
initDate() {
if (this.params.year) {
this.setYears();
}
if (this.params.month) {
this.setMonths();
}
if (this.params.day) {
this.setDays();
}
},
open() {
uni.hideTabBar({
animation: true
})
this.$refs.popup.open('bottom')
},
close() {
uni.showTabBar({
animation: true
})
this.$refs.popup.close()
},
//
reset() {
// this.close();
this.init()
// this.$emit('reset');
},
//
getResult() {
let result = {};
let {
date,
time,
halfs,
halfKey,
valueArr
} = this
if (this.tabIndex) {
let change_date = this.endDate
let start_time = {}
let end_time = {}
if (this.startDate.replace(/\-/g, '/') > this.endDate.replace(/\-/g, '/')) {
this.endDate = this.startDate
this.startDate = change_date
this.optionChange(0)
}
//console.log(this.startDate, this.endDate);
if (this.params.year) {
start_time.year = this.formatNumber(this.initTimeValue(this.startDate).year || 0);
end_time.year = this.formatNumber(this.initTimeValue(this.endDate).year || 0);
}
if (this.params.month) {
start_time.month = this.formatNumber(this.initTimeValue(this.startDate).month || 0);
end_time.month = this.formatNumber(this.initTimeValue(this.endDate).month || 0);
}
if (this.params.day) {
start_time.day = this.formatNumber(this.initTimeValue(this.startDate).day || 0);
end_time.day = this.formatNumber(this.initTimeValue(this.endDate).day || 0);
}
start_time.time = this.startDate;
end_time.time = this.endDate;
start_time.timestamp = new Date(this.startDate.replace(/\-/g, '/')).getTime();
end_time.timestamp = new Date(this.endDate.replace(/\-/g, '/')).getTime();
result = {
start_time,
end_time
}
} else {
if (this.params.year) result.year = this.formatNumber(time.year || 0);
if (this.params.month) result.month = this.formatNumber(time.month || 0);
if (this.params.day) result.day = this.formatNumber(time.day || 0);
result.time = date
if (this.params.half) result.half = halfs[valueArr[halfKey]].value
result.timestamp = new Date(date.replace(/\-/g, '/')).getTime();
//console.log(result, date);
}
result.state = this.state
this.$emit('confirm', result);
// this.close();
},
// picker
setYears() {
let {
time,
end_time
} = this
let {
year
} = end_time
//
this.years = this.generateArray(1950, year);
// this.valueArrpicker
setTimeout(() => {
this.valueArr.splice(this.yearKey, 1, this.getIndex(this.years, time.year));
}, 10)
// console.log()
},
setMonths() {
let {
time,
end_time
} = this
let {
year,
month
} = end_time
if (year == time.year && this.params.year) {
this.months = this.generateArray(1, month);
} else {
this.months = this.generateArray(1, 12);
}
if (time.month > this.months.length) this.time.month = this.months.length;
//
setTimeout(() => {
this.valueArr.splice(this.monthKey, 1, this.getIndex(this.months, time.month));
}, 10)
},
setDays() {
let {
time,
end_time
} = this
let {
year,
month,
day
} = end_time
let totalDays = new Date(time.year, time.month, 0).getDate();
if (year == time.year && month == time.month && this.params.year) {
this.days = this.generateArray(1, day);
} else {
this.days = this.generateArray(1, totalDays);
}
if (time.day > this.days.length) this.time.day = this.days.length;
setTimeout(() => {
this.valueArr.splice(this.dayKey, 1, this.getIndex(this.days, time.day));
}, 10)
},
//
generateArray: function(start, end) {
// end-yearend+1
start = Number(start);
end = Number(end);
end = end > start ? end : start;
//
return [...Array(end + 1).keys()].slice(start);
},
getIndex: function(arr, val) {
let index = arr.indexOf(val);
// index-1(index)~(-1)=-(-1)-1=0
return ~index ? index : 0;
},
//
initTimeValue(defaultTime) {
// IE(uni)"-"
let fdate = defaultTime.replace(/\-/g, '/');
fdate = fdate && fdate.indexOf('/') == -1 ? `2020/01/01 ${fdate}` : fdate;
let time = null;
if (fdate) time = new Date(fdate);
else time = new Date();
//
return {
year: time.getFullYear(),
month: Number(time.getMonth()) + 1,
day: time.getDate(),
}
},
// 100
formatNumber(num) {
return +num < 10 ? '0' + num : String(num);
},
//
getTimestamp(date) {
// yyyy-mm-ddiOS使"/"
let time = date.year + '/' + date.month + '/' + (date.day || '01');
return new Date(time).getTime();
},
touchend(e) {
this.opIndex = -1
},
// picker
change(e) {
this.valueArr = e.detail.value;
let i = 0;
let time = {
year: 0,
month: 0,
day: 0,
}
if (this.params.year) time.year = this.years[this.valueArr[i++]];
if (this.params.month) time.month = this.months[this.valueArr[i++]];
if (this.params.day) time.day = this.days[this.valueArr[i++]];
this.time = time
let date = this.timeFormat(this.getTimestamp(time), this.fmt)
//
if (this.tabIndex) {
if (this.op1Index) {
this.endDate = date;
} else {
this.startDate = date;
}
} else { //
this.date = date;
}
},
tabChange(i) {
this.tabIndex = i
this.$emit('tabChange', i)
if (!i) {
this.time = this.initTimeValue(this.date);
this.initDate()
} else {
this.optionChange(this.op1Index)
}
},
//
optionSelect(i) {
this.opIndex = i;
let end_time = new Date()
let start_time;
switch (i) {
case 0: //
if (this.optionMode == 'day') {
start_time = end_time.setDate(new Date(end_time).getDate() - 3)
} else {
start_time = end_time.setMonth(new Date(end_time).getMonth() - 3)
}
break;
case 1: //
if (this.optionMode == 'day') {
start_time = end_time.setDate(new Date(end_time).getDate() - 7)
} else {
start_time = end_time.setMonth(new Date(end_time).getMonth() - 6)
}
break;
case 2: //
if (this.optionMode == 'day') {
start_time = end_time.setDate(new Date(end_time).getDate() - 15)
} else {
start_time = end_time.setMonth(new Date(end_time).getMonth() - 12)
}
break;
}
this.endDate = this.timeFormat(new Date(), this.fmt)
this.startDate = this.timeFormat(start_time, this.fmt)
this.time = this.initTimeValue(this.op1Index ? this.endDate : this.startDate);
this.initDate()
},
//
optionChange(i) {
this.op1Index = i
this.time = this.initTimeValue(i ? this.endDate : this.startDate);
this.initDate()
}
}
}
</script>
<style lang="scss" scoped>
.flex {
display: flex;
flex-direction: row;
align-items: center;
}
.row-between {
justify-content: space-between;
}
.popup-box {
background-color: #fff;
border-radius: 24rpx 24rpx 0 0;
padding-bottom: 40rpx;
height: 900rpx;
}
.picker-body {
overflow: hidden;
padding: 32rpx 40rpx;
}
.picker-view {
// height: 380rpx;
width: 670rpx;
}
.column-item {
display: flex;
align-items: center;
justify-content: center;
font-size: 32rpx;
color: #23272E;
// height: 76rpx;
height: 38px;
}
.column-item-text {
line-height: 38px;
height: 38px;
font-size: 32rpx;
}
.title {
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
position: relative;
.close {
position: relative;
right: 50rpx;
}
.title-text {
width: 750rpx;
padding: 24rpx 0;
display: flex;
flex-direction: row;
justify-content: center;
.text {
font-size: 32rpx;
font-weight: 600;
}
}
}
.tabs-box {
width: 750rpx;
display: flex;
flex-direction: row;
padding: 0 50rpx 0 32rpx;
align-items: center;
border-bottom: 2rpx solid rgba(225, 225, 225, 0.5);
.tabs-item {
padding: 24rpx 0 22rpx 0;
margin-right: 84rpx;
border-bottom: 4rpx solid #fff;
}
.item-text {
font-size: 28rpx;
}
}
.tabs-check {
border-bottom: 4rpx solid #1DAA9F !important;
.item-text {
color: #1DAA9F;
}
}
.bottom {
// padding: 0 32rpx;
display: flex;
align-items: center;
flex-direction: row;
position: fixed;
bottom: 0;
width: 100%;
padding-bottom: calc(env(safe-area-inset-bottom) + 10rpx);
justify-content: space-around;
.h-btn {
// flex: 1;
width: 300rpx;
height: 80rpx;
background: #0BC7B9;
border-radius: 16rpx;
display: flex;
align-items: center;
border: 2rpx solid #0BC7B9;
justify-content: center;
}
.h-btn-line {
background: #fff;
border: 2rpx solid #E1E7EC;
margin-right: 42rpx;
}
}
.option {
padding: 14rpx 58rpx;
font-size: 28rpx;
border-radius: 16rpx;
background: #F4F7F8;
border: 3rpx solid #F4F7F8;
display: flex;
justify-content: center;
flex-direction: row;
.option-text {
font-size: 28rpx;
font-weight: 500;
color: #333333;
line-height: 40rpx;
}
}
.option-check {
background: #F5FFFF;
border-radius: 16rpx;
border: 3rpx solid #1DAA9F;
.option-text {
color: #1DAA9F;
}
}
.options-box {
padding: 32rpx;
transition-property: height;
transition-duration: .4s;
}
</style>

View File

@ -0,0 +1,51 @@
// padStart 的 polyfill因为某些机型或情况还无法支持es7的padStart比如电脑版的微信小程序
// 所以这里做一个兼容polyfill的兼容处理
if (!String.prototype.padStart) {
// 为了方便表示这里 fillString 用了ES6 的默认参数,不影响理解
String.prototype.padStart = function(maxLength, fillString = ' ') {
if (Object.prototype.toString.call(fillString) !== "[object String]") throw new TypeError(
'fillString must be String')
let str = this
// 返回 String(str) 这里是为了使返回的值是字符串字面量,在控制台中更符合直觉
if (str.length >= maxLength) return String(str)
let fillLength = maxLength - str.length,
times = Math.ceil(fillLength / fillString.length)
while (times >>= 1) {
fillString += fillString
if (times === 1) {
fillString += fillString
}
}
return fillString.slice(0, fillLength) + str;
}
}
// 其他更多是格式化有如下:
// yyyy:mm:dd|yyyy:mm|yyyy年mm月dd日|yyyy年mm月dd日 hh时MM分等,可自定义组合
function timeFormat(dateTime = null, fmt = 'yyyy-mm-dd') {
// 如果为null,则格式化当前时间
if (!dateTime) dateTime = Number(new Date());
// 如果dateTime长度为10或者13则为秒和毫秒的时间戳如果超过13位则为其他的时间格式
if (dateTime.toString().length == 10) dateTime *= 1000;
let date = new Date(dateTime);
let ret;
let opt = {
"y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"h+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"s+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
}
export default timeFormat

View File

@ -0,0 +1,82 @@
{
"id": "h-datetime-picker",
"displayName": "时间日期选择器",
"version": "1.2.6",
"description": "时间日期选择器",
"keywords": [
"h-datetime-picker"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y",
"alipay": "n"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "u"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

View File

@ -0,0 +1,66 @@
## datetime-picker 日期时间选择器
> **组件名h-datetime-picker**
> 代码块: `<h-datetime-picker></h-datetime-picker>`
> 关联组件:`uni-popup uni-icons`。
## 属性说明
参数|说明|类型|默认值
-|-|-|-
params|需要显示的日期格式|Object|{year: true,month: true,day: true,hour: false,minute: false,second: false,timestamp: true,}
defaultTime|默认显示的时间(默认为当前时间)|String|''
startYear|年份开始时间|String,Number|1950
endYear|年份结束时间|String,Number|2050
endMonth|月份结束时间|String,Number|12
optionMode|自定义时间选择栏顶部快捷时间段选择类型可选值month(月)、day(天)|String|month
mode|选择器模式 all(显示月份选择以及时间段选择)、single(仅显示单月份选择)、multiple(仅显示时间段选择) |String|all
startTime|默认起始日期 仅在mode='multiple'时生效 例如2022-5-18 12:00|String|''
endTime|默认截止日期 仅在mode='multiple'时生效 例如2023-5-18 12:00|String|''
@reset|点击重置回调|Handler|无
@confirm|点击确定回调|Handler|无
##@confirm返回说明(对应params)
###单日期(时间)选择
参数|说明|类型
-|-|-|-
year|年|String
month|月|String
day|日|String
hour|时|String
minute|分|String
second|秒|String
timestamp|时间戳|Number
###时间段选择
参数|说明|类型
-|-|-|-
start_time|起始时间 格式与上一致|Object
end_time|截至时间 格式与上一致|Object
##示例
```
<template>
<view>
<h-datetime-picker ref="pickerDate" @reset="reset" @confirm="confirm"></h-datetime-picker>
</view>
</template>
<script>
export default {
methods: {
//打开选择器
open() {
this.$refs.pickerDate.open()
},
reset(){
console.log('点击了重置');
},
confirm(e){
console.log('点击了确定',e);
}
}
}
</script>
```

View File

@ -4,11 +4,17 @@ import store from "@/store/user.js"
// let env = "dev"
// let env = "test"
let env = "prod"
// let env = "local"
switch(env){
case 'prod': BASE_URL = 'https://erp.lihaink.cn';break;
case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break;
default: BASE_URL = 'http://192.168.1.10:8546';
switch (env) {
case 'prod':
BASE_URL = 'https://erp.lihaink.cn';
break;
case 'test':
BASE_URL = 'https://ceshi-erp.lihaink.cn';
break;
default:
BASE_URL = 'http://192.168.1.16:8546';
}
let HTTP_REQUEST_URL
@ -26,7 +32,7 @@ let config = {
//#endif
'TOKEN': ''
},
ENV: env,
ENV: env,
}
export {

View File

@ -1,15 +1,237 @@
<template>
<view class="content">
<view class="head">
<!-- -->
<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> <up-icon color="#20B128" name="arrow-right"></up-icon>
</view>
</view>
<view class="form">
<up-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" :model="model1" :rules="rules"
ref="form1" labelWidth='70'>
<up-form-item label="开户银行" prop="userInfo.name" borderBottom ref="item1" @click="showPop=true">
<text style="padding-left: 20rpx;" v-if="form.bank_id">{{form.bank_name}}</text>
<text v-else style="color: #20B128;padding-left: 20rpx;">点击选择开户银行</text>
</up-form-item>
<up-form-item label="账户名称" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.name" placeholder="请输入账户名称" />
</up-form-item>
<up-form-item label="银行账号" prop="userInfo.name" borderBottom ref="item1">
<up-input maxlength="19" style="border: none;" v-model="form.bank_code" type='number'
placeholder="请输入银行账号" />
</up-form-item>
<up-form-item label="开户网点" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.bank_branch" placeholder="请输入开户网点" />
</up-form-item>
<up-form-item v-if="!form.is_own" label="身份证" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.id_card" placeholder="请输入身份证" />
</up-form-item>
<up-form-item v-if="!form.is_own" label="电话" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.phone" placeholder="请输入电话" />
</up-form-item>
</up-form>
</view>
<view class="submit-btn">
<up-button text="提交绑定" @click="submit" shape="circle" color="#50C758"></up-button>
</view>
<up-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>
<up-icon name="close" color="#303133" size="24" @click="showPop=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></up-icon>
<view class="bank-list">
<view class="bank-li" v-for="item in bankList" :key='item.id' @click="choseBank(item)">
<up-image :show-loading="true" :src="item.image" width="60rpx" height="60rpx"></up-image>
<text style="margin-left: 20rpx;">{{item.name}}</text>
</view>
</view>
</view>
</up-popup>
<up-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>
<up-icon name="close" color="#303133" size="24" @click="showPop1=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></up-icon>
<view class="bank-list">
<view class="bank-li" @click="form.is_own=0,showPop1=false">
<text>个人账户</text>
</view>
<view class="bank-li" @click="form.is_own=1,showPop1=false">
<text>对公账户</text>
</view>
</view>
</view>
</up-popup>
</view>
</template>
<script>
<script setup>
import {
bankListApi,
bindCradApi
} from "@/api/balance.js"
import {
ref,
reactive
} from 'vue';
const showPop = ref(false)
const showPop1 = ref(false)
const bankList = ref([])
const getBankList = async () => {
let res = await bankListApi()
bankList.value = res.data.lists
}
const choseBank = (item) => {
console.log(item)
form.bank_name = item.name
form.bank_id = item.id
showPop.value = false
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
const form = reactive({
"name": "张伟",
"bank_id": 1,
"bank_name": '中国邮政',
"bank_code": "62179967580064578451",
"bank_branch": "",
"financial_img": "",
"is_own": 0,
phone: '1913055023',
"id_card": "513701200012105613",
"mer_id": 500,
user_type: 1
})
const submit = () => {
bindCradApi({
...form
}).then(res => {
uni.navigateBack()
}).catch(err => {
console.log(err)
})
}
// 使 reactive
const state = reactive({
showSex: false,
model1: {
userInfo: {
name: 'uview-plus UI',
sex: '',
},
},
actions: [{
name: '男'
},
{
name: '女'
},
{
name: '保密'
},
],
rules: {
'userInfo.name': {
type: 'string',
required: true,
message: '请填写姓名',
trigger: ['blur', 'change'],
},
'userInfo.sex': {
type: 'string',
max: 1,
required: true,
message: '请选择男或女',
trigger: ['blur', 'change'],
},
},
radio: '',
switchVal: false,
});
// 使 ref
const formRef = ref(null);
//
function sexSelect(e) {
state.model1.userInfo.sex = e.name;
if (formRef.value) {
formRef.value.validateField('userInfo.sex');
}
}
getBankList()
</script>
<style>
<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

@ -1,11 +1,300 @@
<template>
<view class="">
明细
<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="sumTofixed" :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="all_count" bold font-size="22"></u-count-to>
</view>
</view>
</view>
<view class="recoder">
<view class="card" v-for="(item,index) in 10" :key="index">
<view class="right">
<view class="item" style="justify-content: flex-start;">
<text class="rest">余额提现至</text>
<!-- <text class="code">({item.financial_account.bank_code})</text> -->
<text class="code">({item})</text>
<text class="withdraw-type legal_company">{{"对公"}}</text>
</view>
<view class="item">
<view class="item_title">
<!-- <text>{`${item.financial_account.bank}`}</text> -->
<text>{`${item}`}</text>
</view>
<!-- <view class="item_money">+{item.extract_money}</view> -->
<view class="item_money">+{ite}</view>
</view>
<view class="item">
<view class="item-time">{item.create_time}</view>
<view class="item_status audit" v-if="item.status == 0||true">待审核</view>
<!-- <view class="item_status trans" v-if="item.status == 1 && (!item.image || item.length> 0)">待转账
</view>
<view class="item_status done" v-if="item.status == 1 && item.image && item.image.length > 0"
@click="handleView(item)">
已转账
<u-icon name="arrow-right" color="#46B03A"></u-icon>
</view>
<view class="item_status lose" v-if="item.status == -1">审核不通过</view> -->
</view>
</view>
<view class="remark" v-if="item.mark||true">{item.mark}</view>
</view>
</view>
<up-popup :show="showPop" :round="10" mode="bottom" @close="showPop=false" @open="showPop=true">
<hDatetimePicker ref="pickerDate" @reset="showPop=false" @confirm="confirm">
</hDatetimePicker>
</up-popup>
</view>
</template>
<script>
<script setup>
import hDatetimePicker from "@/components/h-datetime-picker/components/h-datetime-picker/h-datetime-picker.vue"
import {
ref,
reactive
} from "vue"
const nowDate = new Date()
// cconst
const showPop = ref(false)
const openDatePicker = () => {
showPop.value = true
}
const confirm = (e) => {
console.log(e)
showPop.value = false
}
</script>
<style>
<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>

View File

@ -20,15 +20,13 @@
<text>绑定账户</text> <up-icon color="#20B128" name="arrow-right"></up-icon>
</view>
</view>
<view class="form">
<!-- 注意如果需要兼容微信小程序最好通过setRules方法设置rules规则 -->
<view class="form" v-if='true'>
<up-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" :model="model1" :rules="rules"
ref="form1" labelWidth='70'>
<up-form-item label="银行卡" prop="userInfo.name" borderBottom ref="item1">
<template #right>
<view style="display: flex;align-items: center;">
<text style="color: #20B128;">选择银行</text> <up-icon color="#20B128"
<text @click="showPop=true" style="color: #20B128;">选择银行</text> <up-icon color="#20B128"
name="arrow-right"></up-icon>
</view>
</template>
@ -45,12 +43,38 @@
<up-form-item label="提现金额" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.name" placeholder="请输入提现金额" />
</up-form-item>
<text style="color: #999999;font-size: 24rpx;">
说明:用户下单后该订单金额存放在暂存金额中用户确认收货后次日18:00才可提现该笔订单金额
提货付款订单在完成后次日18:00才可提现
</text>
</up-form>
</view>
<up-empty mode="data" :text='emptyText'
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/89e93202405131146497294.png" />
<view class="detail" @click="navgo('/pageQuota/Balance/detail')">
明细
</view>
<view class="submit-btn">
<up-button text="提现" shape="circle" color="#50C758"></up-button>
</view>
<up-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>
<up-icon name="close" color="#303133" size="24" @click="showPop=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></up-icon>
<view class="bank-list">
<view class="bank-li" v-for="item in 10">
<up-image :show-loading="true" src="https://cdn.uviewui.com/uview/album/1.jpg" width="60rpx"
height="60rpx"></up-image>
<text style="margin-left: 20rpx;">中国农业银行</text>
</view>
</view>
</view>
</up-popup>
</view>
</template>
@ -59,14 +83,13 @@
ref,
reactive
} from 'vue';
const emptyText = '您尚未绑定提现账户,\n点击右上角"添加账户"'
const showPop = ref(false)
const navgo = (url) => {
uni.navigateTo({
url
})
}
const form = reactive({
@ -155,11 +178,45 @@
}
.popContent {
padding: 20rpx;
.bank-list {
overflow-y: auto;
position: relative;
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

@ -1,14 +1,14 @@
<template>
<view class="content">
<view class="card">
<view class="card-li">
<!-- <view class="card-li">
<text>反馈类型</text>
<text style="color: #737373 ;">注册</text>
</view>
<view class="card-li">
<text>问题分类</text>
<text style="color: #737373 ;">注册</text>
</view>
</view> -->
<view class="card-li">
<text>姓名</text>
<text style="color: #737373 ;">注册</text>

View File

@ -1,6 +1,6 @@
<template>
<view class="content">
<view class="cell-li">
<!-- <view class="cell-li">
<view class="cell-tit">
反馈类型
</view>
@ -18,21 +18,21 @@
</view>
<up-picker confirmColor='#20B128' @confirm='confirm' @cancel='showTypeDetail=false' :show="showTypeDetail"
:columns="columns"></up-picker>
</view>
</view> -->
<view class="cell-li">
<view class="cell-tit" style="margin-bottom: 20rpx;">
反馈内容
</view>
<up-textarea v-model="cont" style="background-color: #F5F5F5;" placeholder="请输入内容" count></up-textarea>
<up-textarea v-model="formData.content" style="background-color: #F5F5F5;" placeholder="请输入内容"
count></up-textarea>
</view>
<view class="cell-li">
<view class="cell-tit" style="margin-bottom: 20rpx;">
图片上传
</view>
<up-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
<up-upload :fileList="formData.images" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10"></up-upload>
</view>
@ -43,7 +43,7 @@
<up-input placeholder="请填写您的姓名" style="background-color: #F5F5F5;margin-bottom: 20rpx;" border="surround"
v-model="formData.name"></up-input>
<up-input placeholder="请输入您的电话或者邮箱" style="background-color: #F5F5F5;" border="surround"
v-model="formData.phone"></up-input>
v-model="formData.contact"></up-input>
</view>
<view class="btn">
<up-button text="提交反馈" @click="submit" shape='circle' color="#20B128"></up-button>
@ -61,6 +61,13 @@
ref,
reactive
} from "vue"
import {
config
} from "@/config/app.js"
import useUserStore from '@/store/user';
const userStore = useUserStore();
const showTypeDetail = ref(false)
const columns = reactive([
['中国', '美国', '日本']
@ -72,8 +79,10 @@
const cont = ref('')
const formData = reactive({
content: "",
images: [],
name: "",
phone: ''
contact: "",
})
@ -120,11 +129,11 @@
const uploadFilePromise = (url) => {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: 'http://192.168.2.21:7001/upload', //
url: config.HTTP_REQUEST_URL + '/api/upload/image', //
filePath: url,
name: 'file',
formData: {
user: 'test',
header: {
token: userStore.token
},
success: (res) => {
setTimeout(() => {

View File

@ -18,140 +18,131 @@
</view>
</view>
</up-sticky>
<view class="content">
<!-- 报价列表 -->
<view v-if="showGoods1">
<up-transition :show="showGoods1" mode="slide-left">
<view class="" v-if="goodsList1.length>0">
<view class="card" v-for="(item,index) in goodsList1" :key='index'>
<view class="head">
<!-- <text> {{orer_sn}}</text> -->
<!-- <text style="color: #989898;">{{time}}</text> -->
</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>
<swiper class="swiper" circular>
<swiper-item>
<view v-if="showGoods1">
<view class="" v-if="goodsList1.length>0">
<view class="card" v-for="(item,index) in goodsList1" :key='index'>
<view class="head">
</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">
<up-input :placeholderStyle="{fontSize:'20rpx'}" placeholder="输入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="background-color:#F6F6F6;border: none;"></up-input>
<!-- <up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" :readonly="tabIndex==2"
v-model="item.num"
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input> -->
<view style="width: 10rpx;">
<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">
<up-input :placeholderStyle="{fontSize:'20rpx'}" placeholder="输入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="background-color:#F6F6F6;border: none;"></up-input>
<view style="width: 10rpx;">
</view>
<up-input :placeholderStyle="{fontSize:'20rpx'}"
style="background-color: #F6F6F6;border: none;" placeholder="输入产品报价"
@blur="priceBlur(index,goodsList1)" :readonly="tabIndex==2"
v-model="item.price"></up-input>
</view>
<up-input :placeholderStyle="{fontSize:'20rpx'}"
style="background-color: #F6F6F6;border: none;" placeholder="输入产品报价"
@blur="priceBlur(index,goodsList1)" :readonly="tabIndex==2"
v-model="item.price"></up-input>
</view>
</view>
<!-- <view class="status-png" v-if="tabIndex==2">
<image v-if="is_storage==1 && is_adopt == 1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else-if="is_storage==0 && is_adopt == 1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else :src="waitPng" style="width: 108rpx; height: 84rpx;">
</image>
</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}}</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</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}}</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view>
<up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
</view>
<up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
<!-- <button @click="test2">叫我按钮</button> -->
</up-transition>
</view>
</swiper-item>
<swiper-item>
<view v-if="showGoods2">
<view v-if="goodsList2.length>0">
<view class="card" v-for="(item,index) in goodsList2" :key='index'>
<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">
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input>
<up-input placeholderStyle='fontSize:24rpx'
style="background-color: #F6F6F6;border: none;" placeholder="点击数入产品报价"
@blur="priceBlur(index,goodsList2)" :readonly="tabIndex==2"
v-model="item.price"></up-input>
</view>
</view>
<view class="status-png" v-if="tabIndex==2">
<image v-if="item.is_adopt==1" :src="waitPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else-if="item.is_adopt==2" :src="successPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else :src="errPng" style="width: 108rpx; height: 84rpx;">
</image>
</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}}</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view>
</view>
<up-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
</view>
</swiper-item>
</swiper>
<!-- 报价列表 -->
<!-- 报价记录 -->
<view v-if="showGoods2">
<up-transition :show="showGoods2" mode="slide-right">
<view class="" v-if="goodsList2.length>0">
<view class="card" v-for="(item,index) in goodsList2" :key='index'>
<view class="head">
<!-- <text> {{orer_sn}}</text> -->
<!-- <text style="color: #989898;">{{time}}</text> -->
</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">
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量"
:readonly="tabIndex==2" v-model="item.nums"
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input>
<!-- <up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" :readonly="tabIndex==2"
v-model="item.num"
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input> -->
<up-input placeholderStyle='fontSize:24rpx'
style="background-color: #F6F6F6;border: none;" placeholder="点击数入产品报价"
@blur="priceBlur(index,goodsList2)" :readonly="tabIndex==2"
v-model="item.price"></up-input>
</view>
</view>
<view class="status-png" v-if="tabIndex==2">
<!-- <image :src="item.is_adopt?successPng:errPng" style="width: 108rpx; height: 84rpx;">
</image> -->
<image v-if="item.is_adopt==1" :src="waitPng" style="width: 108rpx; height: 84rpx;">
</image>
<image v-else-if="item.is_adopt==2" :src="successPng"
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else :src="errPng" style="width: 108rpx; height: 84rpx;">
</image>
</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}}</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view>
</view>
<up-empty v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
</up-transition>
<view class="detail" @click="navgo('/pageQuota/Balance/detail')">
明细
</view>
<view class="submit-btn" v-if="tabIndex==1">
<up-button shape='circle' color='#20B128' @click="submit" text="提交"></up-button>
</view>
</view>
</view>
</template>
@ -177,7 +168,11 @@
const waitPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/274ad202405111523222891.png')
// url
const navgo = (url) => {
uni.navigateTo({
url
})
}
// tabsindex
const tabIndex = ref(1)
@ -354,6 +349,19 @@
}
}
.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;
}
.ellipsis {
white-space: nowrap;
overflow: hidden;

View File

@ -1,416 +1,438 @@
<template>
<view class="wrap">
<up-navbar placeholder :autoBack="true">
<template #center>
<view style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;">
<view class="tabs" :class="{'tabs-active': tabsActive==index}" v-for="(item, index) in list" :key="index"
@click="changeTab(index)">
{{item}}
</view>
</view>
</template>
</up-navbar>
<view class="wrap">
<up-navbar placeholder :autoBack="true">
<template #center>
<view
style="display: flex;align-items: center;width: 100%;justify-content: flex-start;margin-left: 100rpx;">
<view class="tabs" :class="{'tabs-active': tabsActive==index}" v-for="(item, index) in list"
:key="index" @click="changeTab(index)">
{{item}}
</view>
</view>
</template>
</up-navbar>
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1" style="padding-top: 60rpx;">
<view class="total">
<view>共计<text style="color: #20B128;">{{cartList.length}}</text></view>
<view v-if="!isAdmin" @click="isAdmin=true;">管理</view>
<view v-else @click="isAdmin=false;">完成</view>
</view>
<view v-if="cartList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in cartList" :key="index" @click="openGoodPopup(item)">
<view class="shop-check" @click.stop="checkItem(item, !item.check)">
<image v-if="!item.check" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
</view>
<image class="shop-img" :src="item.imgs"></image>
<view class="shop-content">
<view class="title">
<view class="name u-line-2">{{item.goods_name}}</view>
<view class="tip u-line-1">{{item.unit_name}}</view>
</view>
<view class="price-btn">
<view class="price">{{item.sell}}</view>
<view class="btn">
<view class="num">{{item.cart_num}}</view>
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
</view>
</view>
</view>
</view>
</view>
<view v-else style="margin-top: 100rpx;">
<up-empty text="购物车空空如也"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty>
</view>
<view style="width: 100%;height: 200rpx;"></view>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1">
<view v-if="frequentlyList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index" @click="openGoodPopup(item)">
<image class="shop-img" :src="item.imgs"></image>
<view class="shop-content" style="width: 490rpx;">
<view class="title">
<view class="name u-line-2">{{item.name}}</view>
<!-- <view class="tip u-line-1">{{item.spec}}</view> -->
<view class="tip u-line-1">{{item.unit_name}}</view>
</view>
<view class="price-btn">
<view class="price">{{item.sell}}</view>
<view class="btn">
<up-button size="small" plain color="#20b128" shape="circle">加入购物车</up-button>
</view>
</view>
</view>
</view>
</view>
<view v-else style="margin-top: 100rpx;">
<up-empty text="没有常买的商品"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty>
</view>
<view style="width: 100%;height: 200rpx;"></view>
</view>
</scroll-view>
</swiper-item>
</swiper>
<swiper class="swiper-box" :current="swiperCurrent" @animationfinish="animationfinish">
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1" style="padding-top: 60rpx;">
<view class="total">
<view>共计<text style="color: #20B128;">{{cartList.length}}</text></view>
<view v-if="!isAdmin" @click="isAdmin=true;">管理</view>
<view v-else @click="isAdmin=false;">完成</view>
</view>
<view v-if="cartList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in cartList" :key="index"
@click="openGoodPopup(item)">
<view class="shop-check" @click.stop="checkItem(item, !item.check)">
<image v-if="!item.check" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
</view>
<image class="shop-img" :src="item.imgs"></image>
<view class="shop-content">
<view class="title">
<view class="name u-line-2">{{item.goods_name}}</view>
<view class="tip u-line-1">{{item.unit_name}}</view>
</view>
<view class="price-btn">
<view class="price">{{item.sell}}</view>
<view class="btn">
<view class="num">{{item.cart_num}}</view>
<u--icon name="plus-circle-fill" size="20" color="#20b128"></u--icon>
</view>
</view>
</view>
</view>
</view>
<view v-else style="margin-top: 100rpx;">
<up-empty text="购物车空空如也"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty>
</view>
<view style="width: 100%;height: 200rpx;"></view>
</view>
</scroll-view>
</swiper-item>
<swiper-item class="swiper-item">
<scroll-view scroll-y style="height: 100%;width: 100%;">
<view class="page-box1">
<view v-if="frequentlyList.length>0" class="list">
<view class="shop-item" v-for="(item, index) in frequentlyList" :key="index"
@click="openGoodPopup(item)">
<image class="shop-img" :src="item.imgs"></image>
<view class="shop-content" style="width: 490rpx;">
<view class="title">
<view class="name u-line-2">{{item.name}}</view>
<!-- <view class="tip u-line-1">{{item.spec}}</view> -->
<view class="tip u-line-1">{{item.unit_name}}</view>
</view>
<view class="price-btn">
<view class="price">{{item.sell}}</view>
<view class="btn">
<up-button size="small" plain color="#20b128"
shape="circle">加入购物车</up-button>
</view>
</view>
</view>
</view>
</view>
<view v-else style="margin-top: 100rpx;">
<up-empty text="没有常买的商品"
icon="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/29955202404260944367594.png">
</up-empty>
</view>
<view style="width: 100%;height: 200rpx;"></view>
</view>
</scroll-view>
</swiper-item>
</swiper>
</view>
<up-transition :show="tabsActive==0">
<view class="fiexd-btn-box cart-btn">
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
<image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
<text style="font-size: 24rpx;">全选</text>
<text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text>
</view>
<view v-if="!isAdmin" class="btn-boxs">
<view class="all-price">
<view style="width: 80rpx;">合计:</view>
<view class="price">
<text style="font-size: 24rpx;">¥</text>
<text style="font-size: 34rpx;">{{c_price0}}</text>
<text style="font-size: 24rpx;">.{{c_price1}}</text>
</view>
</view>
<view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text v-if="checkAll">({{checkAll}})</text></up-button>
</view>
</view>
<view v-else class="btn-boxs">
<!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></view> -->
<view style="width: 100px;"><up-button @click="deleteCartList()" size="small" plain color="#989898" shape="circle">删除</up-button></view>
</view>
</view>
</up-transition>
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
</view>
<up-transition :show="tabsActive==0">
<view class="fiexd-btn-box cart-btn">
<view class="cart-check" @click="changeAll(checkAll===cartInfo.count)">
<image v-if="checkAll!=cartInfo.count" src="@/static/icon/n-check.png"></image>
<image v-else src="@/static/icon/check.png"></image>
<text style="font-size: 24rpx;">全选</text>
<text style="font-size: 24rpx;" v-if="checkAll">({{checkAll}})</text>
</view>
<view v-if="!isAdmin" class="btn-boxs">
<view class="all-price">
<view style="width: 80rpx;">合计:</view>
<view class="price">
<text style="font-size: 24rpx;">¥</text>
<text style="font-size: 34rpx;">{{c_price0}}</text>
<text style="font-size: 24rpx;">.{{c_price1}}</text>
</view>
</view>
<view style="width: 200rpx;">
<up-button color="#20b128" shape="circle" :disabled="!checkAll" @click="settleAccounts">去结算<text
v-if="checkAll">({{checkAll}})</text></up-button>
</view>
</view>
<view v-else class="btn-boxs">
<!-- <view style="width: 100px;margin-right: 20rpx;"><up-button size="small" plain color="#989898" shape="circle">移入收藏夹</up-button></view> -->
<view style="width: 100px;"><up-button @click="deleteCartList()" size="small" plain color="#989898"
shape="circle">删除</up-button></view>
</view>
</view>
</up-transition>
<goodPopup ref="goodRef" :show="showGoodPopup" @close="showGoodPopup=false" @change="changeGood" />
</template>
<script setup>
import { onShow } from "@dcloudio/uni-app"
import { computed, ref, watch } from 'vue';
import { cartListApi, cartChangeApi, cartCreateApi, cartDeleteApi, frequentlyPurchaseApi } from "@/api/cart.js"
import goodPopup from "@/components/goodPopup.vue"
import useCartStore from "@/store/cart.js"
import {
onShow
} from "@dcloudio/uni-app"
import {
computed,
ref,
watch
} from 'vue';
import {
cartListApi,
cartChangeApi,
cartCreateApi,
cartDeleteApi,
frequentlyPurchaseApi
} from "@/api/cart.js"
import goodPopup from "@/components/goodPopup.vue"
import useCartStore from "@/store/cart.js"
const cartStore = useCartStore();
const cartStore = useCartStore();
//
const list = ref(['购物车', '常买']);
const tabsActive = ref(0)
//
const changeTab = (e) => {
tabsActive.value = e;
swiperCurrent.value = e;
}
//
const list = ref(['购物车', '常买']);
const tabsActive = ref(0)
//
const changeTab = (e) => {
tabsActive.value = e;
swiperCurrent.value = e;
}
const swiperCurrent = ref(0);
const animationfinish = ({ detail: { current } }) => {
swiperCurrent.value = current;
tabsActive.value = current;
if(swiperCurrent.value==1) getFrequentlyPurchase();
}
const swiperCurrent = ref(0);
const animationfinish = ({
detail: {
current
}
}) => {
swiperCurrent.value = current;
tabsActive.value = current;
if (swiperCurrent.value == 1) getFrequentlyPurchase();
}
//
const settleAccounts = ()=>{
let list = [];
cartList.value.forEach(item=>{
if(item.check) list.push(item.cart_id);
})
cartStore.setCartList(list);
uni.navigateTo({
url: '/pagesOrder/settle/settle'
})
}
//
const deleteCartList = ()=>{
let list = [];
cartList.value.forEach(item=>{
if(item.check) list.push(item.cart_id);
})
cartDeleteApi({
cart_id: list
}).then(()=>{
getcartList(false);
})
}
//
const settleAccounts = () => {
let list = [];
cartList.value.forEach(item => {
if (item.check) list.push(item.cart_id);
})
cartStore.setCartList(list);
uni.navigateTo({
url: '/pagesOrder/settle/settle'
})
}
//
const deleteCartList = () => {
let list = [];
cartList.value.forEach(item => {
if (item.check) list.push(item.cart_id);
})
cartDeleteApi({
cart_id: list
}).then(() => {
getcartList(false);
})
}
//
const addCart = (id, cart_num) => { //
cartCreateApi({
cart_num: +cart_num,
goods_id: id
}).then(res => {
getcartList();
})
}
const isAdmin = ref(false); //
//
const addCart = (id, cart_num) => { //
cartCreateApi({
cart_num: +cart_num,
goods_id: id
}).then(res => {
getcartList();
})
}
const isAdmin = ref(false); //
//
const showGoodPopup = ref(false);
const goodRef = ref(null);
const goodData = ref({});
const openGoodPopup = (item) => { // /
goodData.value = JSON.parse(JSON.stringify(item));
goodRef.value.setData(goodData.value);
showGoodPopup.value = true;
};
const changeGood = (data)=>{ //
showGoodPopup.value = false;
addCart(data.goods_id||data.id, data.cart_num);
}
//
const showGoodPopup = ref(false);
const goodRef = ref(null);
const goodData = ref({});
const openGoodPopup = (item) => { // /
goodData.value = JSON.parse(JSON.stringify(item));
goodRef.value.setData(goodData.value);
showGoodPopup.value = true;
};
const changeGood = (data) => { //
showGoodPopup.value = false;
addCart(data.goods_id || data.id, data.cart_num);
}
const cartList = ref([]);
const cartInfo = ref({});
const getcartList = (check=true)=>{
cartListApi().then(res=>{
if(check) {
res.data.lists = res.data.lists.map(item=>{
item.check = true;
return item;
})
checkAll.value = res.data?.count || 0
}else {
checkAll.value = 0
}
cartList.value = res.data.lists;
cartInfo.value = {
total_price: res.data?.extend.total_price || '0.00',
count: res.data?.count || 0
}
})
}
const cartList = ref([]);
const cartInfo = ref({});
const getcartList = (check = true) => {
cartListApi().then(res => {
if (check) {
res.data.lists = res.data.lists.map(item => {
item.check = true;
return item;
})
checkAll.value = res.data?.count || 0
} else {
checkAll.value = 0
}
cartList.value = res.data.lists;
cartInfo.value = {
total_price: res.data?.extend.total_price || '0.00',
count: res.data?.count || 0
}
})
}
const c_price0 = computed(()=>{
let price = cartInfo.value.total_price + '';
return price.split('.')[0] || '0';
})
const c_price1 = computed(()=>{
let price = cartInfo.value.total_price + '';
return price.split('.')[1] || '00';
})
const c_price0 = computed(() => {
let price = cartInfo.value.total_price + '';
return price.split('.')[0] || '0';
})
const c_price1 = computed(() => {
let price = cartInfo.value.total_price + '';
return price.split('.')[1] || '00';
})
//
let checkAll = ref(0)
const checkItem = (item, type)=>{
item.check = type;
let price = Number(cartInfo.value.total_price);
if(type){
price += item.sell * item.cart_num;
checkAll.value++;
}else {
price -= item.sell * item.cart_num;
checkAll.value--;
}
cartInfo.value.total_price = price.toFixed(2);
}
const changeAll = (flag=false)=>{
cartList.value.forEach(item=>{
item.check = !flag;
})
if(!flag) checkAll.value = cartInfo.value.count;
else checkAll.value = 0;
}
//
let checkAll = ref(0)
const checkItem = (item, type) => {
item.check = type;
let price = Number(cartInfo.value.total_price);
if (type) {
price += item.sell * item.cart_num;
checkAll.value++;
} else {
price -= item.sell * item.cart_num;
checkAll.value--;
}
cartInfo.value.total_price = price.toFixed(2);
}
const changeAll = (flag = false) => {
cartList.value.forEach(item => {
item.check = !flag;
})
if (!flag) checkAll.value = cartInfo.value.count;
else checkAll.value = 0;
}
//
const frequentlyList = ref([]);
const where = ref({
page_no: 1,
page_size: 25
})
const getFrequentlyPurchase = ()=>{
frequentlyPurchaseApi({
...where.value
}).then(res=>{
frequentlyList.value = res.data;
})
}
//
const frequentlyList = ref([]);
const where = ref({
page_no: 1,
page_size: 25
})
const getFrequentlyPurchase = () => {
frequentlyPurchaseApi({
...where.value
}).then(res => {
frequentlyList.value = res.data;
})
}
onShow(()=>{
getcartList();
})
onShow(() => {
getcartList();
})
</script>
<style lang="scss">
.tabs {
color: #444444;
font-size: 32rpx;
margin-right: 30rpx;
}
.tabs {
color: #444444;
font-size: 32rpx;
margin-right: 30rpx;
}
.tabs-active {
color: #20B128;
// font-size: 34rpx;
transition: 300ms;
}
.tabs-active {
color: #20B128;
// font-size: 34rpx;
transition: 300ms;
}
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.wrap {
display: flex;
flex-direction: column;
height: calc(100vh - var(--window-top));
width: 100%;
}
.swiper-box {
flex: 1;
}
.swiper-box {
flex: 1;
}
.swiper-item {
height: 100%;
}
.swiper-item {
height: 100%;
}
.page-box1 {
position: relative;
.page-box1 {
position: relative;
.total {
padding: 0 20rpx;
display: flex;
justify-content: space-between;
position: fixed;
top: var(--window-top);
left: 0;
right: 0;
background-color: #f6f6f6;
z-index: 100;
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
color: #444;
}
.total {
padding: 0 20rpx;
display: flex;
justify-content: space-between;
position: fixed;
top: var(--window-top);
left: 0;
right: 0;
background-color: #f6f6f6;
z-index: 100;
height: 60rpx;
line-height: 60rpx;
font-size: 26rpx;
color: #444;
}
.list {
margin: 20rpx;
border-radius: 20rpx;
overflow: hidden;
.list {
margin: 20rpx;
border-radius: 20rpx;
overflow: hidden;
.shop-item {
padding: 20rpx;
border-bottom: 1rpx solid #f6f6f6;
background-color: #fff;
display: flex;
.shop-item {
padding: 20rpx;
border-bottom: 1rpx solid #f6f6f6;
background-color: #fff;
display: flex;
.shop-check {
width: 60rpx;
height: 160rpx;
display: flex;
align-items: center;
.shop-check {
width: 60rpx;
height: 120rpx;
display: flex;
align-items: center;
image {
width: 40rpx;
height: 40rpx;
}
}
image {
width: 40rpx;
height: 40rpx;
}
}
.shop-img {
height: 160rpx;
width: 160rpx;
margin-right: 20rpx;
border-radius: 14rpx;
}
.shop-img {
height: 120rpx;
width: 120rpx;
margin-right: 20rpx;
border-radius: 14rpx;
}
.shop-content {
width: 430rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.shop-content {
width: 430rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
.name {
font-size: 28rpx;
}
.title {
.name {
font-size: 28rpx;
}
.tip {
color: #999;
font-size: 24rpx;
margin: 12rpx 0;
}
}
.tip {
color: #999;
font-size: 24rpx;
margin: 12rpx 0;
}
}
.price {
font-size: 30rpx;
font-weight: bold;
color: #F55726;
}
.price {
font-size: 30rpx;
font-weight: bold;
color: #F55726;
}
.price-btn {
display: flex;
justify-content: space-between;
.price-btn {
display: flex;
justify-content: space-between;
.btn {
display: flex;
align-items: center;
.btn {
display: flex;
align-items: center;
.num {
margin: 0 20rpx;
text-align: center;
}
}
}
}
}
}
}
.num {
margin: 0 20rpx;
text-align: center;
}
}
}
}
}
}
}
.cart-btn {
.cart-btn {
.cart-check {
display: flex;
align-items: center;
.cart-check {
display: flex;
align-items: center;
image {
width: 40rpx;
height: 40rpx;
margin: 0 10rpx;
}
}
image {
width: 40rpx;
height: 40rpx;
margin: 0 10rpx;
}
}
.btn-boxs {
display: flex;
.btn-boxs {
display: flex;
.all-price {
display: flex;
align-items: center;
margin-right: 20rpx;
.all-price {
display: flex;
align-items: center;
margin-right: 20rpx;
.price {
color: #20B128;
display: table-cell;
vertical-align: bottom;
font-weight: bold;
}
}
.price {
color: #20B128;
display: table-cell;
vertical-align: bottom;
font-weight: bold;
}
}
}
}
}
}
</style>

View File

@ -1,109 +1,123 @@
<template>
<view>
<up-navbar title="登录" :autoBack="false" placeholder bgColor="rgba(0,0,0,0)">
<template #left>
<up-icon v-if="!showWeixin" name="arrow-left" @click="navBack" size="20"></up-icon>
<view v-else></view>
</template>
</up-navbar>
<view class="login-box">
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"></image>
<view class="tips">欢迎登录惠农批发</view>
<block v-if="showWeixin">
<up-transition :show="showWeixin">
<view class="btn">
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
size="28"></up-icon></up-button>
</view>
<!-- <view class="btn">
<view>
<up-navbar title="登录" :autoBack="false" placeholder bgColor="rgba(0,0,0,0)">
<template #left>
<up-icon v-if="!showWeixin" @click="navBack" name="arrow-left" size="20"></up-icon>
<view v-else></view>
</template>
</up-navbar>
<view class="login-box">
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png">
</image>
<view class="tips">欢迎登录惠农批发</view>
<block v-if="showWeixin">
<up-transition :show="showWeixin">
<view class="btn">
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill"
color="#fff" size="28"></up-icon></up-button>
</view>
<!-- <view class="btn">
<up-button @click="officialCode" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
size="28"></up-icon></up-button>
</view> -->
<view class="btn">
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
style="color: #20B128;">使用短信验证登录</text></up-button>
</view>
</up-transition>
</block>
<block v-else>
<up-transition :show="!showWeixin">
<view class="form">
<view class="input">
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place" border="none"
placeholder="请输入手机号" type="number">
<template #prefix>
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png"></image>
</template>
</up-input>
</view>
<view class="input">
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4" placeholderClass="place"
border="none" placeholder="请输入验证码" type="number">
<template #prefix>
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png"></image>
</template>
<template #suffix>
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
<view style="color: #20B128;" @click="getCode">{{tips}}</view>
</template>
</up-input>
</view>
</view>
<view class="btn">
<up-button color="#20B128" size="large" @click="codeLogin">登录</up-button>
</view>
</up-transition>
</block>
<view class="agreement">
<image v-if="!isAgree" @click="isAgree=true" src="@/static/icon/n-check.png"></image>
<image v-else @click="isAgree=false" src="@/static/icon/check.png"></image>
<view>
我已同意<text>用户协议</text><text>隐私政策</text>
</view>
</view>
</view>
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
<modal :show="showOfficial" @close="showOfficial = false" @change="officialCode()" title="您还未绑定公众号" content="需要绑定公众号后才可以接收消息" confirmText="立即绑定" />
</view>
<view class="btn">
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
style="color: #20B128;">使用短信验证登录</text></up-button>
</view>
</up-transition>
</block>
<block v-else>
<up-transition :show="!showWeixin">
<view class="form">
<view class="input">
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place"
border="none" placeholder="请输入手机号" type="number">
<template #prefix>
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png">
</image>
</template>
</up-input>
</view>
<view class="input">
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4"
placeholderClass="place" border="none" placeholder="请输入验证码" type="number">
<template #prefix>
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png">
</image>
</template>
<template #suffix>
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
<view style="color: #20B128;" @click="getCode">{{tips}}</view>
</template>
</up-input>
</view>
</view>
<view class="btn">
<up-button color="#20B128" size="large" @click="codeLogin">登录</up-button>
</view>
</up-transition>
</block>
<view class="wx-login" v-if="!showWeixin" @click="navBack">
微信登录
</view>
<view class="agreement">
<image v-if="!isAgree" @click="isAgree=true" src="@/static/icon/n-check.png"></image>
<image v-else @click="isAgree=false" src="@/static/icon/check.png"></image>
<view>
我已同意<text>用户协议</text><text>隐私政策</text>
</view>
</view>
</view>
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
<modal :show="showOfficial" @close="showOfficial = false" @change="officialCode()" title="您还未绑定公众号"
content="需要绑定公众号后才可以接收消息" confirmText="立即绑定" />
</view>
</template>
<script setup>
import { onBackPress } from "@dcloudio/uni-app"
import { ref } from "vue"
import { userLoginApi, userLoginWeixinApi, getMobileByMnpApi } from "@/api/user.js";
import useUserStore from "@/store/user.js"
import bindPhone from "@/components/bindPhone.vue"
import modal from "@/components/modal.vue"
import {
onBackPress
} from "@dcloudio/uni-app"
import {
ref
} from "vue"
import {
userLoginApi,
userLoginWeixinApi,
getMobileByMnpApi
} from "@/api/user.js";
import useUserStore from "@/store/user.js"
import bindPhone from "@/components/bindPhone.vue"
import modal from "@/components/modal.vue"
const showOfficial = ref(false);
const navToIndex = () => {
if (!userStore.userInfo.supplier) uni.reLaunch({
url: '/pages/index/index'
})
else if(userStore.userInfo.supplier&&!userStore.userInfo.supplier.openid) {
return showOfficial.value = true;
}
else{
uni.reLaunch({
url: '/pageQuota/quotation/index'
})
}
}
const showOfficial = ref(false);
const navToIndex = () => {
if (!userStore.userInfo.supplier) uni.reLaunch({
url: '/pages/index/index'
})
else if (userStore.userInfo.supplier && !userStore.userInfo.supplier.openid) {
return showOfficial.value = true;
} else {
uni.reLaunch({
url: '/pageQuota/quotation/index'
})
}
}
//
const officialCode = ()=>{
uni.navigateTo({
url: `/pages/code/code?id=${userStore.userInfo.id}`,
success: () => {
let user = userStore.userInfo;
user.supplier ? user.supplier.openid = 1 : user.supplier = {};
userStore.setUserInfo(user);
}
})
}
//
const officialCode = () => {
uni.navigateTo({
url: `/pages/code/code?id=${userStore.userInfo.id}`,
success: () => {
let user = userStore.userInfo;
user.supplier ? user.supplier.openid = 1 : user.supplier = {};
userStore.setUserInfo(user);
}
})
}
const userStore = useUserStore(); //使pinia
if (userStore.userInfo && userStore.userInfo.mobile) {
@ -144,19 +158,19 @@
}
const showBind = ref(false); //
const getPhoneNumber = (e) => {
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
getMobileByMnpApi({
code: e.detail.code
}).then(res => {
navToIndex();
})
} else {
console.log("用户拒绝授权");
return uni.$u.toast('您拒绝了授权');
}
}
const showBind = ref(false); //
const getPhoneNumber = (e) => {
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
getMobileByMnpApi({
code: e.detail.code
}).then(res => {
navToIndex();
})
} else {
console.log("用户拒绝授权");
return uni.$u.toast('您拒绝了授权');
}
}
const loginForm = ref({
phone: '15366662222',
@ -270,9 +284,25 @@
}
}
.wx-login {
width: 200rpx;
text-align: center;
padding: 20rpx;
border-radius: 100rpx;
background-color: #EFEFEF;
position: absolute;
bottom: 80rpx;
left: 50%;
transform: translateX(-50%);
}
.wx-login:active {
background-color: #ECFFEE;
}
.agreement {
position: absolute;
bottom: 0;
bottom: 0rpx;
left: 0;
width: 100%;
display: flex;

View File

@ -25,7 +25,7 @@ const useUserStore = defineStore("user", () => {
// #ifdef H5
token.value = "601e47691f5dd3e10f3e01da13882910"
token.value = "4f8bef69a4b5a195e9d69a3a72955827"
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
userInfo.value = {
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
@ -35,7 +35,7 @@ const useUserStore = defineStore("user", () => {
mobile: "19330904744",
nickname: "用户1714964250",
supplier: null,
token: "601e47691f5dd3e10f3e01da13882910"
token: "4f8bef69a4b5a195e9d69a3a72955827"
}
// #endif

View File

@ -1,5 +1,5 @@
import {
config
config
} from '@/config/app';
import useUserStore from '@/store/user';
@ -7,70 +7,72 @@ import useUserStore from '@/store/user';
const userStore = useUserStore();
function baseRequest(url, method, data, {
noAuth = false,
noVerify = false,
onReLogin = false
noAuth = false,
noVerify = false,
onReLogin = false
}) {
let Url = config.HTTP_REQUEST_URL,
header = config.HEADER;
if (userStore.userInfo) {
header.TOKEN = userStore.token
}
let Url = config.HTTP_REQUEST_URL,
header = config.HEADER;
if (userStore.userInfo) {
header.TOKEN = userStore.token
}
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api' + url,
method: method || 'GET',
header: {
...header
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
if (res.data.show) {
uni.showToast({
title: res.data.msg || '操作成功',
icon: 'none',
})
}
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if (res.data.msg == "登录超时,请重新登录") {
userStore.setToken('');
userStore.setUserInfo({});
uni.reLaunch({
url: '/pages/login/login'
})
}
} else if (res.data.code == 0) {
reject(res.data);
} else if (res.data.code == 1) {
reslove(res.data);
} else if (res.data.code == 200) {
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
reject(res.data);
} else if (res.data.code == 501) {
reject(res.data);
} else {
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
console.log(message, '错误')
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
return new Promise((reslove, reject) => {
uni.request({
url: Url + '/api' + url,
method: method || 'GET',
header: {
...header
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
// console.log(res, 'res')
if (res.data.show) {
uni.showToast({
title: res.data.msg || '操作成功',
icon: 'none',
})
}
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if (res.data.msg == "登录超时,请重新登录") {
userStore.setToken('');
userStore.setUserInfo({});
uni.reLaunch({
url: '/pages/login/login'
})
}
} else if (res.data.code == 0) {
reject(res.data);
} else if (res.data.code == 1) {
reslove(res.data);
} else if (res.data.code == 200) {
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
reject(res.data);
} else if (res.data.code == 501) {
reject(res.data);
} else {
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
console.log(message, '错误信息')
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
}
const syhttp = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
syhttp[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
});
export default syhttp;