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 = "dev"
// let env = "test" // let env = "test"
let env = "prod" let env = "prod"
// let env = "local"
switch(env){ switch (env) {
case 'prod': BASE_URL = 'https://erp.lihaink.cn';break; case 'prod':
case 'test': BASE_URL = 'https://ceshi-erp.lihaink.cn';break; BASE_URL = 'https://erp.lihaink.cn';
default: BASE_URL = 'http://192.168.1.10:8546'; break;
case 'test':
BASE_URL = 'https://ceshi-erp.lihaink.cn';
break;
default:
BASE_URL = 'http://192.168.1.16:8546';
} }
let HTTP_REQUEST_URL let HTTP_REQUEST_URL
@ -26,7 +32,7 @@ let config = {
//#endif //#endif
'TOKEN': '' 'TOKEN': ''
}, },
ENV: env, ENV: env,
} }
export { export {

View File

@ -1,15 +1,237 @@
<template> <template>
<view class="content"> <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>
<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> </view>
</template> </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> </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> </style>

View File

@ -1,11 +1,300 @@
<template> <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> </view>
</template> </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> </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> </style>

View File

@ -20,15 +20,13 @@
<text>绑定账户</text> <up-icon color="#20B128" name="arrow-right"></up-icon> <text>绑定账户</text> <up-icon color="#20B128" name="arrow-right"></up-icon>
</view> </view>
</view> </view>
<view class="form"> <view class="form" v-if='true'>
<!-- 注意如果需要兼容微信小程序最好通过setRules方法设置rules规则 -->
<up-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" :model="model1" :rules="rules" <up-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" :model="model1" :rules="rules"
ref="form1" labelWidth='70'> ref="form1" labelWidth='70'>
<up-form-item label="银行卡" prop="userInfo.name" borderBottom ref="item1"> <up-form-item label="银行卡" prop="userInfo.name" borderBottom ref="item1">
<template #right> <template #right>
<view style="display: flex;align-items: center;"> <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> name="arrow-right"></up-icon>
</view> </view>
</template> </template>
@ -45,12 +43,38 @@
<up-form-item label="提现金额" prop="userInfo.name" borderBottom ref="item1"> <up-form-item label="提现金额" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.name" placeholder="请输入提现金额" /> <up-input style="border: none;" v-model="form.name" placeholder="请输入提现金额" />
</up-form-item> </up-form-item>
<text style="color: #999999;font-size: 24rpx;">
说明:用户下单后该订单金额存放在暂存金额中用户确认收货后次日18:00才可提现该笔订单金额
提货付款订单在完成后次日18:00才可提现
</text>
</up-form> </up-form>
</view> </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"> <view class="submit-btn">
<up-button text="提现" shape="circle" color="#50C758"></up-button> <up-button text="提现" shape="circle" color="#50C758"></up-button>
</view> </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> </view>
</template> </template>
@ -59,14 +83,13 @@
ref, ref,
reactive reactive
} from 'vue'; } from 'vue';
const emptyText = '您尚未绑定提现账户,\n点击右上角"添加账户"'
const showPop = ref(false)
const navgo = (url) => { const navgo = (url) => {
uni.navigateTo({ uni.navigateTo({
url url
}) })
} }
const form = reactive({ 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 { .submit-btn {
position: fixed; position: fixed;
bottom: 146rpx; bottom: 146rpx;
width: 710rpx; width: 710rpx;
} }
</style> </style>

View File

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

View File

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

View File

@ -18,140 +18,131 @@
</view> </view>
</view> </view>
</up-sticky> </up-sticky>
<view class="content"> <view class="content">
<!-- 报价列表 --> <swiper class="swiper" circular>
<view v-if="showGoods1"> <swiper-item>
<up-transition :show="showGoods1" mode="slide-left"> <view v-if="showGoods1">
<view class="" v-if="goodsList1.length>0"> <view class="" v-if="goodsList1.length>0">
<view class="card" v-for="(item,index) in goodsList1" :key='index'> <view class="card" v-for="(item,index) in goodsList1" :key='index'>
<view class="head"> <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>
<view class="card-content-r"> <view class="card-content">
<view class="title ellipsis"> <view class="card-content-l" style="width: 152rpx;height: 152rpx;">
{{item.goods.name}} <image style="width: 152rpx;height: 152rpx;" :src="item.goods.imgs" mode="">
</view> </image>
<view class="need"> <view class="status">
需求量 {{item.need_num}}{{item.unit_name}} {{tabIndex==1?"未报价":"已报价" }}
</view> </view>
<view class="ipt"> </view>
<up-input :placeholderStyle="{fontSize:'20rpx'}" placeholder="输入报价数量" <view class="card-content-r">
:readonly="tabIndex==2" v-model="item.nums" <view class="title ellipsis">
style="background-color:#F6F6F6;border: none;"></up-input> {{item.goods.name}}
<!-- <up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" :readonly="tabIndex==2" </view>
v-model="item.num" <view class="need">
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input> --> 需求量 {{item.need_num}}{{item.unit_name}}
<view style="width: 10rpx;"> </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> </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> </view>
<!-- <view class="status-png" v-if="tabIndex==2"> <view class="card-footer" v-if="item.nums && item.price">
<image v-if="is_storage==1 && is_adopt == 1" :src="waitPng" {{item.nums}}{{item.unit_name}}&nbsp; &nbsp;合计:<text
style="width: 108rpx; height: 84rpx;"> style="font-size: 28rpx;color: #FC452F;font-weight: 700;">{{item.nums*item.price}}</text>
</image> </view>
<image v-else-if="is_storage==0 && is_adopt == 1" :src="waitPng" <up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
style="width: 108rpx; height: 84rpx;">
</image>
<image v-else :src="waitPng" style="width: 108rpx; height: 84rpx;">
</image>
</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}}</text>
</view>
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
</view> </view>
<up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty>
</view> </view>
<up-empty @click='test2' v-else mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
</up-empty> </swiper-item>
<!-- <button @click="test2">叫我按钮</button> --> <swiper-item>
</up-transition> <view v-if="showGoods2">
</view> <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>
<view class="submit-btn" v-if="tabIndex==1"> <view class="submit-btn" v-if="tabIndex==1">
<up-button shape='circle' color='#20B128' @click="submit" text="提交"></up-button> <up-button shape='circle' color='#20B128' @click="submit" text="提交"></up-button>
</view> </view>
</view> </view>
</view> </view>
</template> </template>
@ -177,7 +168,11 @@
const waitPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/274ad202405111523222891.png') const waitPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/274ad202405111523222891.png')
// url // url
const navgo = (url) => {
uni.navigateTo({
url
})
}
// tabsindex // tabsindex
const tabIndex = ref(1) 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 { .ellipsis {
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;

View File

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

View File

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

View File

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

View File

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