调整 添加贸易条款
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
<template>
|
||||
|
||||
<view class="car-cards" @click="handleCardTap">
|
||||
<view class="car-card">
|
||||
<view class="car-cards" >
|
||||
<view class="heard">
|
||||
<view class="" @click="handleCardTap">
|
||||
编号:{{item.code?item.code:'~'}}
|
||||
</view>
|
||||
<view v-if="ismy">
|
||||
<u-icon @click="detilsfn(item)" name="edit-pen-fill" size="25" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="car-card" @click="handleCardTap">
|
||||
<image class="thumb" :src="item.images_pull[0]" mode="aspectFill" />
|
||||
<view class="info">
|
||||
<view class="row row1">
|
||||
@@ -26,14 +34,14 @@
|
||||
</view>
|
||||
<view class="kv">
|
||||
<text class="k">里程</text>
|
||||
<text class="v">{{ item.mileage }}</text>
|
||||
<text class="v">{{ item.mileage }} <text v-if="item.mileage">Km</text> </text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 操作区:保存 + 分享(方案A:卡片右下角悬浮) -->
|
||||
<view class="card-actions">
|
||||
<view class="actions-lift">
|
||||
<view class="actions-lift" @click="handleCardTap">
|
||||
<text class="">创建时间:</text>
|
||||
<text class="">{{ item.created_at }}</text>
|
||||
</view>
|
||||
@@ -59,12 +67,22 @@
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
ismy:{
|
||||
default: false,
|
||||
type: Boolean
|
||||
},
|
||||
index: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
detilsfn(item){
|
||||
const id = item.id
|
||||
uni.navigateTo({
|
||||
url: `/pages/index/publishedit?id=${id}`
|
||||
})
|
||||
},
|
||||
formatPlateTime(dateStr) {
|
||||
return String(dateStr || '').slice(0, 7) // "2026-01"
|
||||
},
|
||||
@@ -110,12 +128,12 @@
|
||||
},
|
||||
handleToggleSave() {
|
||||
const item = this.item
|
||||
if (item.pdf_src && item.pdf_src != '') {
|
||||
this.downloadpdf(item)
|
||||
} else {
|
||||
// if (item.pdf_src && item.pdf_src != '') {
|
||||
// this.downloadpdf(item)
|
||||
// } else {
|
||||
// 让父组件统一弹出输入框(避免列表里每个卡片都渲染一个 popup)
|
||||
this.$emit('request-price', { item, index: this.index })
|
||||
}
|
||||
// }
|
||||
},
|
||||
buildShareLink(id) {
|
||||
// 统一生成"详情页路径"
|
||||
@@ -230,6 +248,14 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.heard{
|
||||
padding: 5px 10px;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.car-cards {
|
||||
padding-bottom: 6rpx; // 预留右下角按钮空间,避免遮挡信息
|
||||
border-radius: 18rpx;
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<view class="content">
|
||||
<view class="topimg">
|
||||
<uni-file-picker fileMediatype="image" limit="1" :list-styles="imageStyles" :del-icon="false" disable-preview @select="select" @delete="delfn('picture')">
|
||||
<image class="user" :src="userinfo.avatar_url"mode=""></image>
|
||||
<image class="user" :src="userinfo.avatar"mode=""></image>
|
||||
</uni-file-picker>
|
||||
<view>点击更换头像</view>
|
||||
</view>
|
||||
<view class="cell1">
|
||||
<view class="item">手机号</view>
|
||||
<view class="right">
|
||||
<input placeholder="请输入手机号" type="number" v-model="userinfo.mobile"></input>
|
||||
<input placeholder="请输入手机号" type="number" v-model="userinfo.email"></input>
|
||||
</view>
|
||||
</view>
|
||||
<u-divider text=""></u-divider>
|
||||
@@ -65,16 +65,10 @@
|
||||
getinfo(){
|
||||
var that= this;
|
||||
request({
|
||||
url:'user/getInfo',
|
||||
url:'common/user/info',
|
||||
method:'get',
|
||||
}).then(res => {
|
||||
if(res.data.data.position=='null'){
|
||||
res.data.data.position=''
|
||||
}
|
||||
that.userinfo = res.data.data;
|
||||
this.actives = res.data.data.country_id
|
||||
this.country_name = res.data.data.country_name
|
||||
that.select1()
|
||||
})
|
||||
},
|
||||
uploadfn(imgUrl,scene){
|
||||
|
||||
+330
-3
@@ -5,6 +5,14 @@
|
||||
<view class="content">
|
||||
<!-- 基础信息卡片 -->
|
||||
<view class="card">
|
||||
<view class="heard">
|
||||
<view class="">
|
||||
编号:{{detail.code?detail.code:'~'}}
|
||||
</view>
|
||||
<view>
|
||||
<u-icon @click="openPriceDialog()" name="download" size="25" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="title-row">
|
||||
<text class="name">{{ detail.product_name }}</text>
|
||||
</view>
|
||||
@@ -42,7 +50,7 @@
|
||||
|
||||
<view class="kv-item">
|
||||
<text class="k">里程</text>
|
||||
<text class="v">{{ detail.mileage }}</text>
|
||||
<text class="v">{{ detail.mileage }}<text v-if="detail.mileage">Km</text></text>
|
||||
</view>
|
||||
<view class="kv-item">
|
||||
<text class="k">马力</text>
|
||||
@@ -95,6 +103,62 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<view class="price-dialog">
|
||||
<view class="pd-title">设置价格</view>
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">贸易条款</view>
|
||||
<view class="pd-price-line">
|
||||
<uni-data-select
|
||||
v-model="priceForm.trade_term"
|
||||
class="tradeTerm"
|
||||
:localdata="tradeTermOptions"
|
||||
:clear="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">价格</view>
|
||||
<view class="pd-price-line">
|
||||
<view class="pd-input-suffix-wrap">
|
||||
<input
|
||||
class="pd-input pd-input-price pd-input-with-suffix"
|
||||
v-model="priceForm.price"
|
||||
type="number"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入数字"
|
||||
@input="onPriceInput"
|
||||
/>
|
||||
<!-- 币种下拉:放在输入框内部右侧(无边框) -->
|
||||
<view class="pd-currency-suffix">
|
||||
<uni-data-select
|
||||
v-model="priceForm.currency"
|
||||
:localdata="currencyOptions"
|
||||
:clear="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 语言单选 -->
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">语言</view>
|
||||
<radio-group class="pd-radio-group" @change="onLangChange">
|
||||
<label class="pd-radio" v-for="l in langOptions" :key="l.value">
|
||||
<radio :value="l.value" :checked="priceForm.lang === l.value" />
|
||||
<text class="pd-radio-text">{{ l.text }}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="pd-actions">
|
||||
<view class="pd-btn pd-cancel" @tap="closePriceDialog">取消</view>
|
||||
<view class="pd-btn pd-confirm" @tap="confirmPriceDialog">确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -106,7 +170,34 @@
|
||||
id: '',
|
||||
appid: '',
|
||||
detail: {},
|
||||
currentImageIndex: 0
|
||||
currentImageIndex: 0,
|
||||
priceForm: {
|
||||
price: "", // 只存数字字符串
|
||||
currency: "USD", // USD | RUB | AED | EUR
|
||||
lang: "en" // en | ru | es | ar
|
||||
},
|
||||
currencyOptions: [
|
||||
{ value: "USD", text: "美元" },
|
||||
{ value: "CNY", text: "人民币" },
|
||||
{ value: "RUB", text: "卢布" },
|
||||
{ value: "AED", text: "迪拉姆" },
|
||||
{ value: "EUR", text: "欧元" }
|
||||
],
|
||||
langOptions: [
|
||||
{ text: "英语", value: "en" },
|
||||
{ text: "俄语", value: "ru" },
|
||||
{ text: "西班牙语", value: "es" },
|
||||
{ text: "阿拉伯语", value: "ar" }
|
||||
],
|
||||
tradeTermOptions: [
|
||||
{ value: "FOB", text: "FOB" },
|
||||
{ value: "CIF", text: "CIF" },
|
||||
{ value: "EXW", text: "EXW" },
|
||||
{ value: "DDP", text: "DDP" },
|
||||
{ value: "CIP", text: "CIP" },
|
||||
{ value: "FCA", text: "FCA" },
|
||||
{ value: "CFR", text: "CFR" }
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -195,13 +286,131 @@
|
||||
}
|
||||
},
|
||||
reviewFile(file){
|
||||
this.downloadByAnchor(file.src, file.name)
|
||||
this.downloadByAnchor(file.src_pull, file.name)
|
||||
},
|
||||
// 打开弹框时调用:可传默认值(可选)
|
||||
openPriceDialog() {
|
||||
this.priceForm = {
|
||||
trade_term:'',
|
||||
price: "",
|
||||
currency: "USD",
|
||||
lang: "en"
|
||||
}
|
||||
this.$refs.inputDialog.open()
|
||||
},
|
||||
|
||||
closePriceDialog() {
|
||||
this.$refs.inputDialog.close()
|
||||
},
|
||||
|
||||
// 只允许数字 + 可选1个小数点(你要“纯整数”也行,我后面给你一行改法)
|
||||
onPriceInput(e) {
|
||||
let v = (e.detail && e.detail.value) ? String(e.detail.value) : String(this.priceForm.price || "")
|
||||
|
||||
// 过滤掉非数字和点
|
||||
v = v.replace(/[^\d.]/g, "")
|
||||
|
||||
// 只保留第一个小数点
|
||||
const parts = v.split(".")
|
||||
if (parts.length > 2) {
|
||||
v = parts[0] + "." + parts.slice(1).join("")
|
||||
}
|
||||
|
||||
// 去掉开头多余 0(保留 0.xxx)
|
||||
v = v.replace(/^0+(\d)/, "$1")
|
||||
if (v.startsWith(".")) v = "0" + v
|
||||
|
||||
this.priceForm.price = v
|
||||
},
|
||||
|
||||
onCurrencyPickerChange(e) {
|
||||
const idx = Number(e.detail.value || 0)
|
||||
this.currencyIndex = idx
|
||||
this.priceForm.currency = this.currencyOptions[idx]?.value || "USD"
|
||||
},
|
||||
|
||||
onLangChange(e) {
|
||||
this.priceForm.lang = e.detail.value
|
||||
},
|
||||
|
||||
confirmPriceDialog() {
|
||||
// 校验
|
||||
if (!this.priceForm.trade_term) {
|
||||
return uni.showToast({ title: "请选择贸易条款", icon: "none" })
|
||||
}
|
||||
if (!this.priceForm.price) {
|
||||
return uni.showToast({ title: "请输入价格", icon: "none" })
|
||||
}
|
||||
const payload = {
|
||||
trade_term:this.priceForm.trade_term,
|
||||
price: this.priceForm.price, // 数字字符串
|
||||
currency: this.priceForm.currency, // USD/RUB/AED/EUR
|
||||
lang: this.priceForm.lang // en/ru/es/ar
|
||||
}
|
||||
console.log(payload)
|
||||
this.closePriceDialog()
|
||||
this.dialogInputConfirm(payload)
|
||||
},
|
||||
dialogInputConfirm(val) {
|
||||
if (!val.price) {
|
||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
request({
|
||||
url: 'common/usedcar/produce/pdf',
|
||||
method: 'get',
|
||||
data: { id: this.id, price:val.price,currency:val.currency,lang:val.lang,trade_term:val.trade_term }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
this.downloadpdf(this.id)
|
||||
} else {
|
||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
},
|
||||
// H5 下载:用 a 标签触发
|
||||
downloadByAnchor(url, filename) {
|
||||
try {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = filename || ''
|
||||
a.target = '_blank'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
} catch (e) {
|
||||
// 兜底:直接打开
|
||||
if (typeof window !== 'undefined') window.open(url, '_blank')
|
||||
}
|
||||
},
|
||||
downloadpdf(item) {
|
||||
request({
|
||||
url: 'common/usedcar/pdf',
|
||||
method: 'get',
|
||||
data: { id: item }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
this.downloadByAnchor(res.data.data.pdf_url, res.data.data.file_name)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.tradeTerm{
|
||||
border: 1px solid #eae9e9;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.heard{
|
||||
padding: 5px 0px;
|
||||
color: #666;
|
||||
font-size: 12px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f6f7fb;
|
||||
@@ -390,4 +599,122 @@
|
||||
.noneview{
|
||||
text-align: center;
|
||||
}
|
||||
.price-dialog{
|
||||
width: 640rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.pd-title{
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #111;
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pd-row{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.pd-row-col{
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.pd-label{
|
||||
width: 120rpx;
|
||||
font-size: 28rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-input{
|
||||
flex:1;
|
||||
height: 66rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 16rpx;
|
||||
padding: 0 18rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.pd-input-suffix-wrap{
|
||||
position: relative;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pd-input-with-suffix{
|
||||
padding-right: 180rpx; /* 给右侧币种留空间 */
|
||||
}
|
||||
|
||||
.pd-currency-suffix{
|
||||
position: absolute;
|
||||
right: 14rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 140rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
::v-deep .uni-select{
|
||||
border: none !important;
|
||||
}
|
||||
.pd-radio-group{
|
||||
display:flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx 22rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.pd-radio{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
}
|
||||
|
||||
.pd-radio-text{
|
||||
margin-left: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-actions{
|
||||
display:flex;
|
||||
gap: 18rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.pd-btn{
|
||||
flex:1;
|
||||
height: 84rpx;
|
||||
border-radius: 18rpx;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.pd-cancel{
|
||||
background:#f5f5f5;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-confirm{
|
||||
background:#3F435B; /* 你喜欢绿色风格 */
|
||||
color:#fff;
|
||||
font-weight:600;
|
||||
}
|
||||
.pd-price-line{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.pd-input-price{
|
||||
flex: 1;
|
||||
min-width: 240rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
+270
-11
@@ -29,7 +29,7 @@
|
||||
/>
|
||||
</view>
|
||||
</z-paging>
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<!-- <uni-popup ref="inputDialog" type="dialog">
|
||||
<uni-popup-dialog
|
||||
mode="input"
|
||||
title="请输入价格"
|
||||
@@ -37,6 +37,63 @@
|
||||
placeholder="请输入车辆价格"
|
||||
@confirm="dialogInputConfirm"
|
||||
/>
|
||||
</uni-popup> -->
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<view class="price-dialog">
|
||||
<view class="pd-title">设置价格</view>
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">贸易条款</view>
|
||||
<view class="pd-price-line">
|
||||
<uni-data-select
|
||||
v-model="priceForm.trade_term"
|
||||
class="tradeTerm"
|
||||
:localdata="tradeTermOptions"
|
||||
:clear="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">价格</view>
|
||||
<view class="pd-price-line">
|
||||
<view class="pd-input-suffix-wrap">
|
||||
<input
|
||||
class="pd-input pd-input-price pd-input-with-suffix"
|
||||
v-model="priceForm.price"
|
||||
type="number"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入数字"
|
||||
@input="onPriceInput"
|
||||
/>
|
||||
<!-- 币种下拉:放在输入框内部右侧(无边框) -->
|
||||
<view class="pd-currency-suffix">
|
||||
<uni-data-select
|
||||
class="pd-currency-select-suffix"
|
||||
v-model="priceForm.currency"
|
||||
:localdata="currencyOptions"
|
||||
:clear="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 语言单选 -->
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">语言</view>
|
||||
<radio-group class="pd-radio-group" @change="onLangChange">
|
||||
<label class="pd-radio" v-for="l in langOptions" :key="l.value">
|
||||
<radio :value="l.value" :checked="priceForm.lang === l.value" />
|
||||
<text class="pd-radio-text">{{ l.text }}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="pd-actions">
|
||||
<view class="pd-btn pd-cancel" @tap="closePriceDialog">取消</view>
|
||||
<view class="pd-btn pd-confirm" @tap="confirmPriceDialog">确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
@@ -44,7 +101,6 @@
|
||||
<script>
|
||||
import { request } from '@/api/apiT.js'
|
||||
import CarCard from '@/components/CarCard/CarCard.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
CarCard
|
||||
@@ -59,7 +115,35 @@
|
||||
pageSize: 10,
|
||||
loading: false,
|
||||
finished: false,
|
||||
list: []
|
||||
list: [],
|
||||
priceForm: {
|
||||
trade_term:'',
|
||||
price: "", // 只存数字字符串
|
||||
currency: "USD", // USD | RUB | AED | EUR
|
||||
lang: "en" // en | ru | es | ar
|
||||
},
|
||||
currencyOptions: [
|
||||
{ value: "USD", text: "美元" },
|
||||
{ value: "CNY", text: "人民币" },
|
||||
{ value: "RUB", text: "卢布" },
|
||||
{ value: "AED", text: "迪拉姆" },
|
||||
{ value: "EUR", text: "欧元" }
|
||||
],
|
||||
langOptions: [
|
||||
{ text: "英语", value: "en" },
|
||||
{ text: "俄语", value: "ru" },
|
||||
{ text: "西班牙语", value: "es" },
|
||||
{ text: "阿拉伯语", value: "ar" }
|
||||
],
|
||||
tradeTermOptions: [
|
||||
{ value: "FOB", text: "FOB" },
|
||||
{ value: "CIF", text: "CIF" },
|
||||
{ value: "EXW", text: "EXW" },
|
||||
{ value: "DDP", text: "DDP" },
|
||||
{ value: "CIP", text: "CIP" },
|
||||
{ value: "FCA", text: "FCA" },
|
||||
{ value: "CFR", text: "CFR" }
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -171,6 +255,12 @@
|
||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
||||
this.priceDialogValue = ''
|
||||
this.priceForm = {
|
||||
trade_term:'',
|
||||
price:"",
|
||||
currency: "USD",
|
||||
lang: "en"
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
||||
})
|
||||
@@ -201,25 +291,72 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
closePriceDialog() {
|
||||
this.$refs.inputDialog.close()
|
||||
},
|
||||
|
||||
// 只允许数字 + 可选1个小数点(你要“纯整数”也行,我后面给你一行改法)
|
||||
onPriceInput(e) {
|
||||
let v = (e.detail && e.detail.value) ? String(e.detail.value) : String(this.priceForm.price || "")
|
||||
|
||||
// 过滤掉非数字和点
|
||||
v = v.replace(/[^\d.]/g, "")
|
||||
|
||||
// 只保留第一个小数点
|
||||
const parts = v.split(".")
|
||||
if (parts.length > 2) {
|
||||
v = parts[0] + "." + parts.slice(1).join("")
|
||||
}
|
||||
|
||||
// 去掉开头多余 0(保留 0.xxx)
|
||||
v = v.replace(/^0+(\d)/, "$1")
|
||||
if (v.startsWith(".")) v = "0" + v
|
||||
|
||||
this.priceForm.price = v
|
||||
},
|
||||
|
||||
onCurrencyPickerChange(e) {
|
||||
const idx = Number(e.detail.value || 0)
|
||||
this.currencyIndex = idx
|
||||
this.priceForm.currency = this.currencyOptions[idx]?.value || "USD"
|
||||
},
|
||||
|
||||
onLangChange(e) {
|
||||
this.priceForm.lang = e.detail.value
|
||||
},
|
||||
|
||||
confirmPriceDialog() {
|
||||
if (!this.priceForm.trade_term) {
|
||||
return uni.showToast({ title: "请选择贸易条款", icon: "none" })
|
||||
}
|
||||
// 校验
|
||||
if (!this.priceForm.price) {
|
||||
return uni.showToast({ title: "请输入价格", icon: "none" })
|
||||
}
|
||||
|
||||
const payload = {
|
||||
trade_term:this.priceForm.trade_term,
|
||||
price: this.priceForm.price, // 数字字符串
|
||||
currency: this.priceForm.currency, // USD/RUB/AED/EUR
|
||||
lang: this.priceForm.lang // en/ru/es/ar
|
||||
}
|
||||
console.log(payload)
|
||||
this.closePriceDialog()
|
||||
this.dialogInputConfirm(payload)
|
||||
},
|
||||
dialogInputConfirm(val) {
|
||||
const item = this.priceDialogItem
|
||||
const index = this.priceDialogIndex
|
||||
const price = String(val || '').trim()
|
||||
|
||||
if (!item) return
|
||||
if (!price) {
|
||||
if (!val.price) {
|
||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (isNaN(price) || Number(price) <= 0) {
|
||||
uni.showToast({ title: '请输入有效的价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
request({
|
||||
url: 'common/usedcar/produce/pdf',
|
||||
method: 'get',
|
||||
data: { id: item.id, price }
|
||||
data: { id: item.id, price:val.price,currency:val.currency,lang:val.lang,trade_term:val.trade_term }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
||||
@@ -272,6 +409,10 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tradeTerm{
|
||||
border: 1px solid #eae9e9;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f4f6f8;
|
||||
@@ -300,4 +441,122 @@
|
||||
.loadmore {
|
||||
padding: 18rpx 0 6rpx;
|
||||
}
|
||||
.price-dialog{
|
||||
width: 640rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.pd-title{
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #111;
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pd-row{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.pd-row-col{
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.pd-label{
|
||||
width: 120rpx;
|
||||
font-size: 28rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-input{
|
||||
flex:1;
|
||||
height: 66rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 16rpx;
|
||||
padding: 0 18rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.pd-input-suffix-wrap{
|
||||
position: relative;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pd-input-with-suffix{
|
||||
padding-right: 180rpx; /* 给右侧币种留空间 */
|
||||
}
|
||||
|
||||
.pd-currency-suffix{
|
||||
position: absolute;
|
||||
right: 14rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 140rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
::v-deep .uni-select{
|
||||
border: none !important;
|
||||
}
|
||||
.pd-radio-group{
|
||||
display:flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx 22rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.pd-radio{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
}
|
||||
|
||||
.pd-radio-text{
|
||||
margin-left: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-actions{
|
||||
display:flex;
|
||||
gap: 18rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.pd-btn{
|
||||
flex:1;
|
||||
height: 84rpx;
|
||||
border-radius: 18rpx;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.pd-cancel{
|
||||
background:#f5f5f5;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-confirm{
|
||||
background:#3F435B; /* 你喜欢绿色风格 */
|
||||
color:#fff;
|
||||
font-weight:600;
|
||||
}
|
||||
.pd-price-line{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.pd-input-price{
|
||||
flex: 1;
|
||||
min-width: 240rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
+111
-7
@@ -79,6 +79,7 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.initFeishuShare()
|
||||
// H5:处理分享兜底参数 r(如果路由没命中/经历登录回跳,会先落到首页)
|
||||
// #ifdef H5
|
||||
try {
|
||||
@@ -98,6 +99,89 @@
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
isFeishuEnv() {
|
||||
// 飞书/ Lark 客户端内置浏览器 UA 通常包含 Feishu / Lark
|
||||
try {
|
||||
const ua = (navigator.userAgent || '').toLowerCase()
|
||||
return ua.includes('feishu') || ua.includes('lark')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
loadFeishuJSSDK() {
|
||||
// 动态加载飞书 H5 JS-SDK(避免你还要改 public/index.html)
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
// 已加载
|
||||
if (typeof window !== 'undefined' && window.h5sdk && window.tt) return resolve(true)
|
||||
// H5 才有 document
|
||||
if (typeof document === 'undefined') return reject(new Error('not in h5 environment'))
|
||||
// 已插入但未 ready
|
||||
const existed = document.querySelector('script[data-feishu-h5sdk="1"]')
|
||||
if (existed) {
|
||||
existed.addEventListener('load', () => resolve(true))
|
||||
existed.addEventListener('error', () => reject(new Error('feishu sdk load error')))
|
||||
return
|
||||
}
|
||||
const s = document.createElement('script')
|
||||
s.async = true
|
||||
s.src = 'https://lf-scm-cn.feishucdn.com/lark/op/h5-js-sdk-1.5.44.js'
|
||||
s.onload = () => resolve(true)
|
||||
s.onerror = () => reject(new Error('feishu sdk load error'))
|
||||
document.head.appendChild(s)
|
||||
} catch (e) {
|
||||
reject(e)
|
||||
}
|
||||
})
|
||||
},
|
||||
getFeishuSignUrl() {
|
||||
// 飞书签名通常要求“去掉 hash 的完整 URL”
|
||||
try {
|
||||
return window.location.href.split('#')[0]
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
initFeishuShare() {
|
||||
try {
|
||||
// 确保在飞书环境
|
||||
// if (!this.isFeishuEnv()) return
|
||||
// 动态加载 SDK
|
||||
this.loadFeishuJSSDK()
|
||||
|
||||
// 这里需要后端提供签名接口:返回 { appId, timestamp, nonceStr, signature }
|
||||
// 你可以按你后端习惯改成:request({ url: 'xxx', ... })
|
||||
// const signUrl = encodeURIComponent(this.getFeishuSignUrl())
|
||||
const signUrl = this.getFeishuSignUrl()
|
||||
|
||||
request({
|
||||
url:'common/auth/feishu/signature',
|
||||
method:'get',
|
||||
data: {url:signUrl,app_id:uni.getStorageSync('fsappid')}
|
||||
}).then(res => {
|
||||
var cfg = res.data.data;
|
||||
window.h5sdk.config({
|
||||
appId: cfg.appId || uni.getStorageSync('fsappid'),
|
||||
timestamp: cfg.timestamp,
|
||||
nonceStr: cfg.nonceStr,
|
||||
signature: cfg.signature,
|
||||
jsApiList: ['shareWebContent','share']
|
||||
})
|
||||
|
||||
window.h5sdk.ready(() => {
|
||||
this._feishuReady = true
|
||||
})
|
||||
window.h5sdk.error((err) => {
|
||||
this._feishuReady = false
|
||||
console.error('Feishu JSSDK error:', err)
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
// 不要阻塞页面,失败就走 H5 的兜底分享
|
||||
console.error('initFeishuShare failed:', e)
|
||||
}
|
||||
},
|
||||
onRequestPrice(payload) {
|
||||
// payload: { item, index }
|
||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
||||
@@ -107,6 +191,32 @@
|
||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
||||
})
|
||||
},
|
||||
// H5 下载:用 a 标签触发
|
||||
downloadByAnchor(url, filename) {
|
||||
try {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = filename || ''
|
||||
a.target = '_blank'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
} catch (e) {
|
||||
// 兜底:直接打开
|
||||
if (typeof window !== 'undefined') window.open(url, '_blank')
|
||||
}
|
||||
},
|
||||
downloadpdf(item) {
|
||||
request({
|
||||
url: 'common/usedcar/pdf',
|
||||
method: 'get',
|
||||
data: { id: item.id }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
this.downloadByAnchor(res.data.data.pdf_url, res.data.data.file_name)
|
||||
}
|
||||
})
|
||||
},
|
||||
dialogInputConfirm(val) {
|
||||
const item = this.priceDialogItem
|
||||
const index = this.priceDialogIndex
|
||||
@@ -130,13 +240,7 @@
|
||||
if (res.data.code == 200) {
|
||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
||||
this.onSearch()
|
||||
|
||||
// 直接调用对应卡片实例的下载方法(如果 ref 数组存在的话)
|
||||
const cards = this.$refs.carCard
|
||||
const card = Array.isArray(cards) ? cards[index] : cards
|
||||
if (card && typeof card.downloadpdf === 'function') {
|
||||
card.downloadpdf(item)
|
||||
}
|
||||
this.downloadpdf(item)
|
||||
} else {
|
||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
||||
}
|
||||
|
||||
+296
-45
@@ -26,6 +26,7 @@
|
||||
>
|
||||
<CarCard
|
||||
:item="item"
|
||||
:ismy="true"
|
||||
@pdfchange="onSearch"
|
||||
@request-price="onRequestPrice"
|
||||
/>
|
||||
@@ -33,13 +34,61 @@
|
||||
</view>
|
||||
</z-paging>
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<uni-popup-dialog
|
||||
mode="input"
|
||||
title="请输入价格"
|
||||
:value="priceDialogValue"
|
||||
placeholder="请输入车辆价格"
|
||||
@confirm="dialogInputConfirm"
|
||||
<view class="price-dialog">
|
||||
<view class="pd-title">设置价格</view>
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">贸易条款</view>
|
||||
<view class="pd-price-line">
|
||||
<uni-data-select
|
||||
v-model="priceForm.trade_term"
|
||||
class="tradeTerm"
|
||||
:localdata="tradeTermOptions"
|
||||
:clear="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">价格</view>
|
||||
<view class="pd-price-line">
|
||||
<view class="pd-input-suffix-wrap">
|
||||
<input
|
||||
class="pd-input pd-input-price pd-input-with-suffix"
|
||||
v-model="priceForm.price"
|
||||
type="number"
|
||||
inputmode="decimal"
|
||||
placeholder="请输入数字"
|
||||
@input="onPriceInput"
|
||||
/>
|
||||
<!-- 币种下拉:放在输入框内部右侧(无边框) -->
|
||||
<view class="pd-currency-suffix">
|
||||
<uni-data-select
|
||||
class="pd-currency-select-suffix"
|
||||
v-model="priceForm.currency"
|
||||
:localdata="currencyOptions"
|
||||
:clear="false"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 语言单选 -->
|
||||
<view class="pd-row">
|
||||
<view class="pd-label">语言</view>
|
||||
<radio-group class="pd-radio-group" @change="onLangChange">
|
||||
<label class="pd-radio" v-for="l in langOptions" :key="l.value">
|
||||
<radio :value="l.value" :checked="priceForm.lang === l.value" />
|
||||
<text class="pd-radio-text">{{ l.text }}</text>
|
||||
</label>
|
||||
</radio-group>
|
||||
</view>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<view class="pd-actions">
|
||||
<view class="pd-btn pd-cancel" @tap="closePriceDialog">取消</view>
|
||||
<view class="pd-btn pd-confirm" @tap="confirmPriceDialog">确认</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
@@ -62,12 +111,6 @@
|
||||
style: {
|
||||
backgroundColor: '#007aff'
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#F56C6C'
|
||||
}
|
||||
}
|
||||
],
|
||||
keyword: '',
|
||||
@@ -75,7 +118,35 @@
|
||||
pageSize: 10,
|
||||
loading: false,
|
||||
finished: false,
|
||||
list: []
|
||||
list: [],
|
||||
priceForm: {
|
||||
trade_term:'',
|
||||
price: "", // 只存数字字符串
|
||||
currency: "USD", // USD | RUB | AED | EUR
|
||||
lang: "en" // en | ru | es | ar
|
||||
},
|
||||
currencyOptions: [
|
||||
{ value: "USD", text: "美元" },
|
||||
{ value: "CNY", text: "人民币" },
|
||||
{ value: "RUB", text: "卢布" },
|
||||
{ value: "AED", text: "迪拉姆" },
|
||||
{ value: "EUR", text: "欧元" }
|
||||
],
|
||||
langOptions: [
|
||||
{ text: "英语", value: "en" },
|
||||
{ text: "俄语", value: "ru" },
|
||||
{ text: "西班牙语", value: "es" },
|
||||
{ text: "阿拉伯语", value: "ar" }
|
||||
],
|
||||
tradeTermOptions: [
|
||||
{ value: "FOB", text: "FOB" },
|
||||
{ value: "CIF", text: "CIF" },
|
||||
{ value: "EXW", text: "EXW" },
|
||||
{ value: "DDP", text: "DDP" },
|
||||
{ value: "CIP", text: "CIP" },
|
||||
{ value: "FCA", text: "FCA" },
|
||||
{ value: "CFR", text: "CFR" }
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
@@ -187,6 +258,12 @@
|
||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
||||
this.priceDialogValue = ''
|
||||
this.priceForm = {
|
||||
trade_term:'',
|
||||
price:"",
|
||||
currency: "USD",
|
||||
lang: "en"
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
||||
})
|
||||
@@ -217,29 +294,77 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
closePriceDialog() {
|
||||
this.$refs.inputDialog.close()
|
||||
},
|
||||
|
||||
// 只允许数字 + 可选1个小数点(你要“纯整数”也行,我后面给你一行改法)
|
||||
onPriceInput(e) {
|
||||
let v = (e.detail && e.detail.value) ? String(e.detail.value) : String(this.priceForm.price || "")
|
||||
|
||||
// 过滤掉非数字和点
|
||||
v = v.replace(/[^\d.]/g, "")
|
||||
|
||||
// 只保留第一个小数点
|
||||
const parts = v.split(".")
|
||||
if (parts.length > 2) {
|
||||
v = parts[0] + "." + parts.slice(1).join("")
|
||||
}
|
||||
|
||||
// 去掉开头多余 0(保留 0.xxx)
|
||||
v = v.replace(/^0+(\d)/, "$1")
|
||||
if (v.startsWith(".")) v = "0" + v
|
||||
|
||||
this.priceForm.price = v
|
||||
},
|
||||
|
||||
onCurrencyPickerChange(e) {
|
||||
const idx = Number(e.detail.value || 0)
|
||||
this.currencyIndex = idx
|
||||
this.priceForm.currency = this.currencyOptions[idx]?.value || "USD"
|
||||
},
|
||||
|
||||
onLangChange(e) {
|
||||
this.priceForm.lang = e.detail.value
|
||||
},
|
||||
|
||||
confirmPriceDialog() {
|
||||
if (!this.priceForm.trade_term) {
|
||||
return uni.showToast({ title: "请选择贸易条款", icon: "none" })
|
||||
}
|
||||
// 校验
|
||||
if (!this.priceForm.price) {
|
||||
return uni.showToast({ title: "请输入价格", icon: "none" })
|
||||
}
|
||||
|
||||
const payload = {
|
||||
trade_term:this.priceForm.trade_term,
|
||||
price: this.priceForm.price, // 数字字符串
|
||||
currency: this.priceForm.currency, // USD/RUB/AED/EUR
|
||||
lang: this.priceForm.lang // en/ru/es/ar
|
||||
}
|
||||
console.log(payload)
|
||||
this.closePriceDialog()
|
||||
this.dialogInputConfirm(payload)
|
||||
},
|
||||
dialogInputConfirm(val) {
|
||||
const item = this.priceDialogItem
|
||||
const index = this.priceDialogIndex
|
||||
const price = String(val || '').trim()
|
||||
|
||||
if (!item) return
|
||||
if (!price) {
|
||||
if (!val.price) {
|
||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (isNaN(price) || Number(price) <= 0) {
|
||||
uni.showToast({ title: '请输入有效的价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
request({
|
||||
url: 'common/usedcar/produce/pdf',
|
||||
method: 'get',
|
||||
data: { id: item.id, price }
|
||||
data: { id: item.id, price:val.price,currency:val.currency,lang:val.lang,trade_term:val.trade_term }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
||||
this.onSearch()
|
||||
|
||||
this.downloadpdf(item)
|
||||
} else {
|
||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
||||
@@ -287,40 +412,48 @@
|
||||
let {
|
||||
content
|
||||
} = e;
|
||||
if (content.text === '删除') {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '是否删除',
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
request({
|
||||
url:'common/usedcar/destroy',
|
||||
method:'post',
|
||||
data: {id:item.id}
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
});
|
||||
this.queryList()
|
||||
})
|
||||
} else if (res.cancel) {
|
||||
console.log('用户点击取消');
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const id = item.id
|
||||
uni.navigateTo({
|
||||
url: `/pages/index/publishedit?id=${id}`
|
||||
})
|
||||
}
|
||||
// if (content.text === '删除') {
|
||||
// uni.showModal({
|
||||
// title: '提示',
|
||||
// content: '是否删除',
|
||||
// success: res => {
|
||||
// if (res.confirm) {
|
||||
// request({
|
||||
// url:'common/usedcar/destroy',
|
||||
// method:'post',
|
||||
// data: {id:item.id}
|
||||
// }).then(res => {
|
||||
// uni.showToast({
|
||||
// title: res.data.message,
|
||||
// icon: 'none'
|
||||
// });
|
||||
// this.queryList()
|
||||
// })
|
||||
// } else if (res.cancel) {
|
||||
// console.log('用户点击取消');
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// const id = item.id
|
||||
// uni.navigateTo({
|
||||
// url: `/pages/index/publishedit?id=${id}`
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.tradeTerm{
|
||||
border: 1px solid #eae9e9;
|
||||
border-radius: 6px;
|
||||
}
|
||||
.page {
|
||||
min-height: 100vh;
|
||||
background: #f4f6f8;
|
||||
@@ -349,4 +482,122 @@
|
||||
.loadmore {
|
||||
padding: 18rpx 0 6rpx;
|
||||
}
|
||||
.price-dialog{
|
||||
width: 640rpx;
|
||||
background: #fff;
|
||||
border-radius: 24rpx;
|
||||
padding: 28rpx;
|
||||
}
|
||||
|
||||
.pd-title{
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
color: #111;
|
||||
margin-bottom: 20rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.pd-row{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.pd-row-col{
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.pd-label{
|
||||
width: 120rpx;
|
||||
font-size: 28rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-input{
|
||||
flex:1;
|
||||
height: 66rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 16rpx;
|
||||
padding: 0 18rpx;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.pd-input-suffix-wrap{
|
||||
position: relative;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.pd-input-with-suffix{
|
||||
padding-right: 180rpx; /* 给右侧币种留空间 */
|
||||
}
|
||||
|
||||
.pd-currency-suffix{
|
||||
position: absolute;
|
||||
right: 14rpx;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 140rpx;
|
||||
height: 80rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
::v-deep .uni-select{
|
||||
border: none !important;
|
||||
}
|
||||
.pd-radio-group{
|
||||
display:flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx 22rpx;
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.pd-radio{
|
||||
display:flex;
|
||||
align-items:center;
|
||||
}
|
||||
|
||||
.pd-radio-text{
|
||||
margin-left: 10rpx;
|
||||
font-size: 26rpx;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-actions{
|
||||
display:flex;
|
||||
gap: 18rpx;
|
||||
margin-top: 40rpx;
|
||||
}
|
||||
|
||||
.pd-btn{
|
||||
flex:1;
|
||||
height: 84rpx;
|
||||
border-radius: 18rpx;
|
||||
display:flex;
|
||||
align-items:center;
|
||||
justify-content:center;
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.pd-cancel{
|
||||
background:#f5f5f5;
|
||||
color:#333;
|
||||
}
|
||||
|
||||
.pd-confirm{
|
||||
background:#3F435B; /* 你喜欢绿色风格 */
|
||||
color:#fff;
|
||||
font-weight:600;
|
||||
}
|
||||
.pd-price-line{
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.pd-input-price{
|
||||
flex: 1;
|
||||
min-width: 240rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
+200
-32
@@ -1,20 +1,9 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<!-- 列表 -->
|
||||
<z-paging ref="paging" v-model="list" @query="queryList" empty-view-text="暂无发布信息!">
|
||||
<uni-nav-bar
|
||||
leftText=" "
|
||||
leftIcon="back"
|
||||
@clickLeft="goBack"
|
||||
:fixed="true"
|
||||
:border="false"
|
||||
color="#000000"
|
||||
backgroundColor="#fff"
|
||||
:statusBar="true"
|
||||
title="我的发布"
|
||||
></uni-nav-bar>
|
||||
|
||||
<!-- 顶部:搜索 -->
|
||||
<z-paging ref="paging" v-model="list" @query="queryList" empty-view-text="暂无数据!">
|
||||
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="首页"></uni-nav-bar> -->
|
||||
<!-- 顶部:标题 + 搜索(不想要搜索可直接删除这一块) -->
|
||||
<view class="page-head">
|
||||
<view class="head-search">
|
||||
<u-search
|
||||
@@ -28,7 +17,6 @@
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="list-wrap">
|
||||
<uni-swipe-action-item
|
||||
v-for="item in list"
|
||||
@@ -38,10 +26,21 @@
|
||||
>
|
||||
<CarCard
|
||||
:item="item"
|
||||
@pdfchange="onSearch"
|
||||
@request-price="onRequestPrice"
|
||||
/>
|
||||
</uni-swipe-action-item>
|
||||
</view>
|
||||
</z-paging>
|
||||
<uni-popup ref="inputDialog" type="dialog">
|
||||
<uni-popup-dialog
|
||||
mode="input"
|
||||
title="请输入价格"
|
||||
:value="priceDialogValue"
|
||||
placeholder="请输入车辆价格"
|
||||
@confirm="dialogInputConfirm"
|
||||
/>
|
||||
</uni-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -55,6 +54,9 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
priceDialogItem: null,
|
||||
priceDialogIndex: -1,
|
||||
priceDialogValue: '',
|
||||
options1: [{
|
||||
text: '编辑',
|
||||
style: {
|
||||
@@ -66,7 +68,8 @@
|
||||
style: {
|
||||
backgroundColor: '#F56C6C'
|
||||
}
|
||||
}],
|
||||
}
|
||||
],
|
||||
keyword: '',
|
||||
page: 1,
|
||||
pageSize: 10,
|
||||
@@ -76,8 +79,173 @@
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.initFeishuShare()
|
||||
// H5:处理分享兜底参数 r(如果路由没命中/经历登录回跳,会先落到首页)
|
||||
// #ifdef H5
|
||||
try {
|
||||
const u = new URL(window.location.href)
|
||||
const r = u.searchParams.get('r')
|
||||
if (r) {
|
||||
const target = decodeURIComponent(r)
|
||||
// 清理地址栏的 r,避免反复跳转
|
||||
u.searchParams.delete('r')
|
||||
window.history.replaceState({}, '', u.toString())
|
||||
// 让首页加载完再跳
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({ url: target })
|
||||
}, 50)
|
||||
}
|
||||
} catch (e) {}
|
||||
// #endif
|
||||
},
|
||||
methods: {
|
||||
isFeishuEnv() {
|
||||
// 飞书/ Lark 客户端内置浏览器 UA 通常包含 Feishu / Lark
|
||||
try {
|
||||
const ua = (navigator.userAgent || '').toLowerCase()
|
||||
return ua.includes('feishu') || ua.includes('lark')
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
loadFeishuJSSDK() {
|
||||
// 动态加载飞书 H5 JS-SDK(避免你还要改 public/index.html)
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
// 已加载
|
||||
if (typeof window !== 'undefined' && window.h5sdk && window.tt) return resolve(true)
|
||||
// H5 才有 document
|
||||
if (typeof document === 'undefined') return reject(new Error('not in h5 environment'))
|
||||
// 已插入但未 ready
|
||||
const existed = document.querySelector('script[data-feishu-h5sdk="1"]')
|
||||
if (existed) {
|
||||
existed.addEventListener('load', () => resolve(true))
|
||||
existed.addEventListener('error', () => reject(new Error('feishu sdk load error')))
|
||||
return
|
||||
}
|
||||
const s = document.createElement('script')
|
||||
s.async = true
|
||||
s.src = 'https://lf-scm-cn.feishucdn.com/lark/op/h5-js-sdk-1.5.44.js'
|
||||
s.onload = () => resolve(true)
|
||||
s.onerror = () => reject(new Error('feishu sdk load error'))
|
||||
document.head.appendChild(s)
|
||||
} catch (e) {
|
||||
reject(e)
|
||||
}
|
||||
})
|
||||
},
|
||||
getFeishuSignUrl() {
|
||||
// 飞书签名通常要求“去掉 hash 的完整 URL”
|
||||
try {
|
||||
return window.location.href.split('#')[0]
|
||||
} catch (e) {
|
||||
return ''
|
||||
}
|
||||
},
|
||||
initFeishuShare() {
|
||||
try {
|
||||
// 确保在飞书环境
|
||||
// if (!this.isFeishuEnv()) return
|
||||
// 动态加载 SDK
|
||||
this.loadFeishuJSSDK()
|
||||
|
||||
// 这里需要后端提供签名接口:返回 { appId, timestamp, nonceStr, signature }
|
||||
// 你可以按你后端习惯改成:request({ url: 'xxx', ... })
|
||||
// const signUrl = encodeURIComponent(this.getFeishuSignUrl())
|
||||
const signUrl = this.getFeishuSignUrl()
|
||||
|
||||
request({
|
||||
url:'common/auth/feishu/signature',
|
||||
method:'get',
|
||||
data: {url:signUrl,app_id:uni.getStorageSync('fsappid')}
|
||||
}).then(res => {
|
||||
var cfg = res.data.data;
|
||||
window.h5sdk.config({
|
||||
appId: cfg.appId || uni.getStorageSync('fsappid'),
|
||||
timestamp: cfg.timestamp,
|
||||
nonceStr: cfg.nonceStr,
|
||||
signature: cfg.signature,
|
||||
jsApiList: ['shareWebContent','share']
|
||||
})
|
||||
|
||||
window.h5sdk.ready(() => {
|
||||
this._feishuReady = true
|
||||
})
|
||||
window.h5sdk.error((err) => {
|
||||
this._feishuReady = false
|
||||
console.error('Feishu JSSDK error:', err)
|
||||
})
|
||||
})
|
||||
} catch (e) {
|
||||
// 不要阻塞页面,失败就走 H5 的兜底分享
|
||||
console.error('initFeishuShare failed:', e)
|
||||
}
|
||||
},
|
||||
onRequestPrice(payload) {
|
||||
// payload: { item, index }
|
||||
this.priceDialogItem = payload && payload.item ? payload.item : null
|
||||
this.priceDialogIndex = payload && typeof payload.index === 'number' ? payload.index : -1
|
||||
this.priceDialogValue = ''
|
||||
this.$nextTick(() => {
|
||||
this.$refs.inputDialog && this.$refs.inputDialog.open()
|
||||
})
|
||||
},
|
||||
// H5 下载:用 a 标签触发
|
||||
downloadByAnchor(url, filename) {
|
||||
try {
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = filename || ''
|
||||
a.target = '_blank'
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
} catch (e) {
|
||||
// 兜底:直接打开
|
||||
if (typeof window !== 'undefined') window.open(url, '_blank')
|
||||
}
|
||||
},
|
||||
downloadpdf(item) {
|
||||
request({
|
||||
url: 'common/usedcar/pdf',
|
||||
method: 'get',
|
||||
data: { id: item.id }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
this.downloadByAnchor(res.data.data.pdf_url, res.data.data.file_name)
|
||||
}
|
||||
})
|
||||
},
|
||||
dialogInputConfirm(val) {
|
||||
const item = this.priceDialogItem
|
||||
const index = this.priceDialogIndex
|
||||
const price = String(val || '').trim()
|
||||
|
||||
if (!item) return
|
||||
if (!price) {
|
||||
uni.showToast({ title: '请输入价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (isNaN(price) || Number(price) <= 0) {
|
||||
uni.showToast({ title: '请输入有效的价格', icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
request({
|
||||
url: 'common/usedcar/produce/pdf',
|
||||
method: 'get',
|
||||
data: { id: item.id, price }
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
// 通知刷新列表(你原来就是靠这个事件刷新)
|
||||
this.onSearch()
|
||||
this.downloadpdf(item)
|
||||
} else {
|
||||
uni.showToast({ title: res.data.msg || '生成失败', icon: 'none' })
|
||||
}
|
||||
})
|
||||
},
|
||||
onKeywordChange(val) {
|
||||
// val 是输入值(uView 通常会传)
|
||||
this.keyword = val
|
||||
@@ -89,35 +257,33 @@
|
||||
}, 300)
|
||||
},
|
||||
onSearch() {
|
||||
this.queryList(this.page, this.pageSize)
|
||||
this.queryList(this.page,this.pageSize)
|
||||
},
|
||||
queryList(pageNo, pageSize, from) {
|
||||
this.loading = true;
|
||||
var that = this;
|
||||
const params = {
|
||||
current: pageNo,
|
||||
status: 1,
|
||||
size: 10,
|
||||
scene: 'self' // 只获取自己的发布
|
||||
current:pageNo,
|
||||
status:1,
|
||||
size:10
|
||||
};
|
||||
params.keyword = this.keyword;
|
||||
params.scene = 'self';
|
||||
request({
|
||||
url: 'common/usedcar/list',
|
||||
method: 'get',
|
||||
url:'common/usedcar/list',
|
||||
method:'get',
|
||||
data: params
|
||||
}).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
if(res.data.code ==200){
|
||||
var datas = res.data.data.records;
|
||||
this.$refs.paging.complete(datas);
|
||||
} else {
|
||||
}else{
|
||||
}
|
||||
uni.stopPullDownRefresh();
|
||||
//
|
||||
})
|
||||
},
|
||||
goBack() {
|
||||
uni.navigateBack()
|
||||
},
|
||||
swipeClick(e, item) {
|
||||
swipeClick(e,item){
|
||||
let {
|
||||
content
|
||||
} = e;
|
||||
@@ -128,9 +294,9 @@
|
||||
success: res => {
|
||||
if (res.confirm) {
|
||||
request({
|
||||
url: 'common/usedcar/destroy',
|
||||
method: 'post',
|
||||
data: { id: item.id }
|
||||
url:'common/usedcar/destroy',
|
||||
method:'post',
|
||||
data: {id:item.id}
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
@@ -165,6 +331,8 @@
|
||||
width: 100%;
|
||||
bottom: 0px;
|
||||
z-index: 99;
|
||||
// padding: 28rpx 24rpx 18rpx;
|
||||
// background: linear-gradient(180deg, rgba(255, 151, 47, 0.22) 0%, rgba(255, 151, 47, 0.06) 55%, #f4f6f8 100%);
|
||||
}
|
||||
|
||||
.head-search {
|
||||
|
||||
+135
-7
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<view>
|
||||
|
||||
<view class="pages">
|
||||
<!-- <uni-nav-bar leftText=" " :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="二手车录入"></uni-nav-bar> -->
|
||||
<view class="content">
|
||||
<view class="cell">
|
||||
@@ -76,7 +77,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="cell">
|
||||
<view>里程</view>
|
||||
<view>里程(Km)</view>
|
||||
<view class="right">
|
||||
<input placeholder="请输入里程" v-model="carinfo.mileage" />
|
||||
</view>
|
||||
@@ -90,11 +91,25 @@
|
||||
<view class="cont">
|
||||
<view class="conts">产品图</view>
|
||||
<view class="media-upload-wrapper">
|
||||
<uni-file-picker ref="mediaPicker" limit="20" fileMediatype="image" @select="selectMedia" @delete="delfn" >
|
||||
<!-- #ifdef H5 -->
|
||||
<view class="h5-picker-grid">
|
||||
<view class="h5-thumb" v-for="(u, idx) in imagesurl" :key="idx">
|
||||
<image :src="u" mode="aspectFill" class="h5-thumb-img"></image>
|
||||
<view class="h5-thumb-del" @tap.stop="delfn({ index: idx })">删除</view>
|
||||
</view>
|
||||
<view class="upload-icon-wrapper" @tap="pickImagesH5">
|
||||
<image src="/static/image/img.png" class="addimg"></image>
|
||||
<!-- <view class="h5-count">{{ carinfo.images.length }}/{{ maxMedia }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef H5 -->
|
||||
<uni-file-picker ref="mediaPicker" :limit="maxMedia" fileMediatype="image" @select="selectMedia" @delete="delfn" >
|
||||
<view class="upload-icon-wrapper">
|
||||
<image src="/static/image/img.png" mode="" class="addimg"></image>
|
||||
<image src="/static/image/img.png" class="addimg"></image>
|
||||
</view>
|
||||
</uni-file-picker>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="cont">
|
||||
@@ -161,7 +176,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { request,showToast } from '@/api/apiT.js'
|
||||
@@ -177,6 +192,7 @@
|
||||
boundProduct:null,
|
||||
keyword:''
|
||||
},
|
||||
imagesurl:[],
|
||||
carinfo:{
|
||||
product_name:'',
|
||||
vin:'',
|
||||
@@ -196,7 +212,9 @@
|
||||
crawl_series:'',
|
||||
crawl_year:'',
|
||||
crawl_msrp:'',
|
||||
crawl_car_id:''
|
||||
crawl_car_id:'',
|
||||
crawl_brand_id:'',
|
||||
crawl_series_id:''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -288,6 +306,8 @@
|
||||
this.carinfo.crawl_year = it.year
|
||||
this.carinfo.crawl_msrp = it.msrp
|
||||
this.carinfo.crawl_car_id = it.car_id
|
||||
this.carinfo.crawl_brand_id = it.brand_id
|
||||
this.carinfo.crawl_series_id = it.series_id
|
||||
console.log(it)
|
||||
this.closeBindDialog()
|
||||
uni.showToast({ title: '绑定成功', icon: 'none' })
|
||||
@@ -299,6 +319,8 @@
|
||||
this.carinfo.crawl_year = ''
|
||||
this.carinfo.crawl_msrp = ''
|
||||
this.carinfo.crawl_car_id = ''
|
||||
this.carinfo.crawl_brand_id = ''
|
||||
this.carinfo.crawl_series_id = ''
|
||||
this.bindState.boundProduct = null
|
||||
uni.showToast({ title: '已清除绑定', icon: 'none' })
|
||||
},
|
||||
@@ -350,13 +372,63 @@
|
||||
if(res && res.data && res.data.file_name){
|
||||
resolve(res.data)
|
||||
}else{
|
||||
reject('上传失败')
|
||||
reject(res)
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
// H5 专用:绕过 uni.chooseImage/chooseMedia 的 9 张限制,使用 uni.chooseFile 支持最多 20 个
|
||||
pickImagesH5() {
|
||||
// const remain = this.maxMedia - this.carinfo.images.length
|
||||
// if (remain <= 0) {
|
||||
// return uni.showToast({ title: `最多只能上传${this.maxMedia}张`, icon: 'none' })
|
||||
// }
|
||||
uni.chooseFile({
|
||||
count: 100,
|
||||
type: 'image',
|
||||
success: (res) => {
|
||||
const paths = (res.tempFilePaths || (res.tempFiles || []).map(it => it.path)).filter(Boolean)
|
||||
if (!paths.length) return
|
||||
Promise.all(paths.map(p => this.uploadfndile(p, 'usedcarimg'))).then(urls => {
|
||||
urls.forEach(url => {
|
||||
this.imagesurl.push(url.file_url)
|
||||
this.carinfo.images.push(url.file_name)
|
||||
})
|
||||
}).catch((e) => {
|
||||
uni.showToast({ title: e.message, icon: 'none' })
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
pickAttachmentH5() {
|
||||
const remain = this.maxMedia - this.carinfo.attachment.length
|
||||
if (remain <= 0) {
|
||||
return uni.showToast({ title: `最多只能上传${this.maxMedia}个`, icon: 'none' })
|
||||
}
|
||||
uni.chooseFile({
|
||||
count: remain,
|
||||
type: 'all',
|
||||
success: (res) => {
|
||||
const files = res.tempFiles || []
|
||||
const paths = (res.tempFilePaths || files.map(it => it.path)).filter(Boolean)
|
||||
if (!paths.length) return
|
||||
Promise.all(paths.map(p => this.uploadfndile(p, 'usedcarfile'))).then(urls => {
|
||||
urls.forEach((url, idx) => {
|
||||
const obj = {}
|
||||
obj.name = url.original_name || files[idx]?.name || '附件'
|
||||
obj.src = url.file_name
|
||||
this.carinfo.attachment.push(obj)
|
||||
})
|
||||
}).catch(() => {
|
||||
uni.showToast({ title:e.message, icon: 'none' })
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
selectMedia(e){
|
||||
const allowCount = this.maxMedia - this.carinfo.images.length
|
||||
const tempFilePaths = e.tempFilePaths || (e.tempFiles || []).map(item => item.path || item.url)
|
||||
@@ -376,6 +448,7 @@
|
||||
})
|
||||
},
|
||||
delfn(e){
|
||||
this.imagesurl.splice(e.index, 1)
|
||||
this.carinfo.images.splice(e.index, 1)
|
||||
},
|
||||
selectMedia1(e){
|
||||
@@ -432,6 +505,9 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.pages{
|
||||
max-width: 650px;
|
||||
}
|
||||
.uniui-right{
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
@@ -739,4 +815,56 @@
|
||||
opacity: .45;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* H5 自定义选择器:用于突破 9 个限制(H5 最多 20) */
|
||||
.h5-picker-grid{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap: 16rpx;
|
||||
align-items:flex-start;
|
||||
}
|
||||
.h5-thumb{
|
||||
width: 210rpx;
|
||||
height: 210rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow:hidden;
|
||||
position: relative;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
.h5-thumb-img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.h5-thumb-del{
|
||||
position:absolute;
|
||||
right: 8rpx;
|
||||
top: 8rpx;
|
||||
background: rgba(0,0,0,0.45);
|
||||
color:#fff;
|
||||
font-size: 22rpx;
|
||||
padding: 6rpx 10rpx;
|
||||
border-radius: 999rpx;
|
||||
}
|
||||
.h5-count{
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color:#999;
|
||||
text-align:center;
|
||||
}
|
||||
.h5-attach-grid .h5-attach{
|
||||
width: 210rpx;
|
||||
min-height: 120rpx;
|
||||
padding: 16rpx;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 12rpx;
|
||||
background: #fafafa;
|
||||
position: relative;
|
||||
}
|
||||
.h5-attach-name{
|
||||
font-size: 24rpx;
|
||||
color:#333;
|
||||
word-break: break-all;
|
||||
padding-right: 60rpx;
|
||||
}
|
||||
</style>
|
||||
+443
-191
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="pages">
|
||||
<!-- <uni-nav-bar leftText=" " @clickLeft="leftClick" leftIcon="back" :fixed="true" :border="false" color="#fff" backgroundColor="#3F435B" :statusBar="true" title="车辆编辑"></uni-nav-bar> -->
|
||||
<view class="content">
|
||||
<!-- 产品名称 + 绑定 -->
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
<!-- 已绑定提示 -->
|
||||
<view v-if="bindState.boundProduct" class="bind-tip">
|
||||
<text class="bind-tip-text">已绑定:{{ bindState.boundProduct.name || bindState.boundProduct.product_name || bindState.boundProduct.title || '-' }}</text>
|
||||
<text
|
||||
class="bind-tip-text">已绑定:{{ bindState.boundProduct.name || bindState.boundProduct.product_name || bindState.boundProduct.title || '-' }}</text>
|
||||
<text class="bind-tip-clear" @tap.stop="clearBind">清除</text>
|
||||
</view>
|
||||
|
||||
@@ -53,15 +54,8 @@
|
||||
<view class="cell">
|
||||
<view>上牌时间</view>
|
||||
<view class="right">
|
||||
<uni-datetime-picker
|
||||
ref="borrowTimePicker"
|
||||
type="date"
|
||||
v-model="carinfo.plate_time"
|
||||
placeholder="请选择时间"
|
||||
:border="false"
|
||||
:clear-icon="false"
|
||||
@change="onBorrowTimeChange"
|
||||
>
|
||||
<uni-datetime-picker ref="borrowTimePicker" type="date" v-model="carinfo.plate_time"
|
||||
placeholder="请选择时间" :border="false" :clear-icon="false" @change="onBorrowTimeChange">
|
||||
<view class="custom-datetime-input">
|
||||
<text class="custom-datetime-text" :class="{ 'placeholder': !carinfo.plate_time }">
|
||||
{{ carinfo.plate_time || '请选择时间' }}
|
||||
@@ -87,7 +81,7 @@
|
||||
</view>
|
||||
|
||||
<view class="cell">
|
||||
<view>里程</view>
|
||||
<view>里程(Km)</view>
|
||||
<view class="right">
|
||||
<input placeholder="请输入里程" v-model="carinfo.mileage" />
|
||||
</view>
|
||||
@@ -103,27 +97,34 @@
|
||||
<view class="cont">
|
||||
<view class="conts">产品图</view>
|
||||
<view class="media-upload-wrapper">
|
||||
<uni-file-picker
|
||||
ref="mediaPicker"
|
||||
v-model="fileList"
|
||||
:limit="maxMedia"
|
||||
file-mediatype="image"
|
||||
mode="grid"
|
||||
:auto-upload="false"
|
||||
@select="selectMedia"
|
||||
@delete="delfn"
|
||||
>
|
||||
|
||||
<!-- #ifdef H5 -->
|
||||
<view class="h5-img-grid">
|
||||
<view class="h5-img-item" v-for="(it, idx) in fileList" :key="idx">
|
||||
<image :src="it.url" class="h5-img" mode="aspectFill"></image>
|
||||
<view class="h5-img-del" @tap.stop="deleteImageAt(idx)">×</view>
|
||||
</view>
|
||||
<view class="upload-icon-wrapper h5-img-add" @tap="pickImagesH5">
|
||||
<image src="/static/image/img.png" mode="" class="addimg"></image>
|
||||
<!-- <view class="h5-img-count">{{ fileList.length }}/{{ maxMedia }}</view> -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef H5 -->
|
||||
<uni-file-picker ref="mediaPicker" v-model="fileList" :limit="maxMedia" file-mediatype="image"
|
||||
mode="grid" :auto-upload="false" @select="selectMedia" @delete="delfn">
|
||||
<view class="upload-icon-wrapper">
|
||||
<image src="/static/image/img.png" mode="" class="addimg"></image>
|
||||
</view>
|
||||
</uni-file-picker>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="cont">
|
||||
<view class="conts">车况介绍</view>
|
||||
<view>
|
||||
<textarea auto-height v-model="carinfo.condition_desc" placeholder="请输入车况介绍"/>
|
||||
<textarea auto-height v-model="carinfo.condition_desc" placeholder="请输入车况介绍" />
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -131,16 +132,8 @@
|
||||
<view class="cont">
|
||||
<view class="conts">附件</view>
|
||||
<view class="media-upload-wrapper">
|
||||
<uni-file-picker
|
||||
ref="filePicker"
|
||||
v-model="fileListAttach"
|
||||
:limit="maxMedia"
|
||||
file-mediatype="all"
|
||||
mode="grid"
|
||||
:auto-upload="false"
|
||||
@select="selectMedia1"
|
||||
@delete="delfn1"
|
||||
>
|
||||
<uni-file-picker ref="filePicker" v-model="fileListAttach" :limit="maxMedia" file-mediatype="all"
|
||||
mode="grid" :auto-upload="false" @select="selectMedia1" @delete="delfn1">
|
||||
<view class="upload-icon-wrapper">
|
||||
<image src="/static/image/photo.png" mode="" class="addimg"></image>
|
||||
</view>
|
||||
@@ -164,8 +157,10 @@
|
||||
|
||||
<!-- 弹框内搜索:仅过滤接口返回列表 -->
|
||||
<view class="bind-search" v-if="bindState.list && bindState.list.length">
|
||||
<input class="bind-search-input" v-model="bindState.keyword" placeholder="搜索产品名称/编码" placeholder-class="bind-search-placeholder" />
|
||||
<text v-if="bindState.keyword" class="bind-search-clear" @tap.stop="bindState.keyword = ''">清除</text>
|
||||
<input class="bind-search-input" v-model="bindState.keyword" placeholder="搜索产品名称/编码"
|
||||
placeholder-class="bind-search-placeholder" />
|
||||
<text v-if="bindState.keyword" class="bind-search-clear"
|
||||
@tap.stop="bindState.keyword = ''">清除</text>
|
||||
</view>
|
||||
|
||||
<scroll-view scroll-y class="bind-dialog-body">
|
||||
@@ -173,15 +168,12 @@
|
||||
<view v-else-if="!bindState.list.length" class="bind-empty">未找到匹配的产品</view>
|
||||
<view v-else-if="!filteredBindList.length" class="bind-empty">未找到匹配结果</view>
|
||||
<view v-else>
|
||||
<view
|
||||
class="bind-item"
|
||||
:class="{ active: bindState.selectedId === getBindItemId(it, idx) }"
|
||||
v-for="(it, idx) in filteredBindList"
|
||||
:key="getBindItemId(it, idx)"
|
||||
@tap="selectBind(it, idx)"
|
||||
>
|
||||
<view class="bind-item" :class="{ active: bindState.selectedId === getBindItemId(it, idx) }"
|
||||
v-for="(it, idx) in filteredBindList" :key="getBindItemId(it, idx)"
|
||||
@tap="selectBind(it, idx)">
|
||||
<view class="bind-item-main">
|
||||
<text class="bind-item-title">{{ it.name || it.product_name || it.title || ('产品 ' + (idx + 1)) }}</text>
|
||||
<text
|
||||
class="bind-item-title">{{ it.name || it.product_name || it.title || ('产品 ' + (idx + 1)) }}</text>
|
||||
<text class="bind-item-sub">{{ formatBindSub(it) }}</text>
|
||||
</view>
|
||||
<view class="bind-item-check">
|
||||
@@ -193,7 +185,8 @@
|
||||
|
||||
<view class="bind-dialog-foot">
|
||||
<view class="btn btn-ghost" @tap="closeBindDialog">取消</view>
|
||||
<view class="btn btn-primary" :class="{ disabled: !bindState.selectedId }" @tap="confirmBind">确认绑定</view>
|
||||
<view class="btn btn-primary" :class="{ disabled: !bindState.selectedId }" @tap="confirmBind">确认绑定
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -201,12 +194,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { request, showToast } from '@/api/apiT.js'
|
||||
import {
|
||||
request,
|
||||
showToast
|
||||
} from '@/api/apiT.js'
|
||||
|
||||
export default {
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
maxMedia: 20,
|
||||
maxMedia: 200,
|
||||
|
||||
// 图片回显列表(uni-file-picker v-model)
|
||||
fileList: [],
|
||||
@@ -251,7 +247,9 @@ export default {
|
||||
crawl_series: '',
|
||||
crawl_year: '',
|
||||
crawl_msrp: '',
|
||||
crawl_car_id: ''
|
||||
crawl_car_id: '',
|
||||
crawl_brand_id:'',
|
||||
crawl_series_id:''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -290,7 +288,9 @@ export default {
|
||||
request({
|
||||
url: 'common/usedcar/show',
|
||||
method: 'GET',
|
||||
data: { id: this.id }
|
||||
data: {
|
||||
id: this.id
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.code !== 200) return
|
||||
const d = res.data.data || {}
|
||||
@@ -312,7 +312,8 @@ export default {
|
||||
src: a.src || a.file_path || a.file_name || ''
|
||||
}))
|
||||
} else if (d.attachment) {
|
||||
const parsed = typeof d.attachment === 'string' ? JSON.parse(d.attachment) : d.attachment
|
||||
const parsed = typeof d.attachment === 'string' ? JSON.parse(d.attachment) : d
|
||||
.attachment
|
||||
attachArr = Array.isArray(parsed) ? parsed : []
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -320,16 +321,18 @@ export default {
|
||||
}
|
||||
|
||||
// 绑定信息:详情接口会返回 crawl_* 字段(示例数据里就是 crawl_*)
|
||||
const bound = (d.crawl_car_id || d.crawl_title || d.crawl_brand || d.crawl_series)
|
||||
? {
|
||||
const bound = (d.crawl_car_id || d.crawl_title || d.crawl_brand || d.crawl_series) ?
|
||||
{
|
||||
car_id: d.crawl_car_id,
|
||||
title: d.crawl_title,
|
||||
brand_name: d.crawl_brand,
|
||||
series_name: d.crawl_series,
|
||||
year: d.crawl_year,
|
||||
msrp: d.crawl_msrp
|
||||
}
|
||||
: null
|
||||
msrp: d.crawl_msrp,
|
||||
brand_id:d.crawl_brand_id,
|
||||
series_id:d.crawl_series_id
|
||||
} :
|
||||
null
|
||||
|
||||
this.carinfo = {
|
||||
...this.carinfo,
|
||||
@@ -350,23 +353,32 @@ export default {
|
||||
const raw = String(u || '')
|
||||
const filename = raw.split('?')[0].split('/').pop() || `img_${idx + 1}`
|
||||
const ext = filename.includes('.') ? filename.split('.').pop() : ''
|
||||
return { url: raw, name: filename, extname: ext }
|
||||
return {
|
||||
url: raw,
|
||||
name: filename,
|
||||
extname: ext
|
||||
}
|
||||
})
|
||||
|
||||
// 附件回显:优先用 attachment_pull(带签名 URL),否则用 attachment 里的 src
|
||||
const pullsFiles = (Array.isArray(d.attachment_pull) && d.attachment_pull.length)
|
||||
? d.attachment_pull
|
||||
: (this.carinfo.attachment || [])
|
||||
const pullsFiles = (Array.isArray(d.attachment_pull) && d.attachment_pull.length) ?
|
||||
d.attachment_pull :
|
||||
(this.carinfo.attachment || [])
|
||||
|
||||
this.fileListAttach = (pullsFiles || []).map((u, idx) => {
|
||||
const raw = typeof u === 'string'
|
||||
? String(u)
|
||||
: String(u?.src || '')
|
||||
const filename = (typeof u === 'object' && u)
|
||||
? String(u.name || u.original_name || '').trim() || (raw.split('?')[0].split('/').pop() || `file_${idx + 1}`)
|
||||
: (raw.split('?')[0].split('/').pop() || `file_${idx + 1}`)
|
||||
const raw = typeof u === 'string' ?
|
||||
String(u) :
|
||||
String(u?.src || '')
|
||||
const filename = (typeof u === 'object' && u) ?
|
||||
String(u.name || u.original_name || '').trim() || (raw.split('?')[0].split('/')
|
||||
.pop() || `file_${idx + 1}`) :
|
||||
(raw.split('?')[0].split('/').pop() || `file_${idx + 1}`)
|
||||
const ext = filename.includes('.') ? filename.split('.').pop() : ''
|
||||
return { url: raw, name: filename, extname: ext }
|
||||
return {
|
||||
url: raw,
|
||||
name: filename,
|
||||
extname: ext
|
||||
}
|
||||
})
|
||||
|
||||
// 已绑定提示:用 crawl_* 拼一个 boundProduct
|
||||
@@ -379,7 +391,7 @@ export default {
|
||||
uploadFileByScene(filePath, scene) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: 'https://userdcar-server.hnxinyouhe.com/upload?scene='+scene,
|
||||
url: 'https://userdcar-server.hnxinyouhe.com/upload?scene=' + scene,
|
||||
filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
@@ -392,26 +404,30 @@ export default {
|
||||
if (r && r.data && r.data.file_name) {
|
||||
resolve(r.data)
|
||||
} else {
|
||||
reject('上传失败')
|
||||
reject(r)
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
uploadfn(imgUrl,scene){
|
||||
uploadfn(imgUrl, scene) {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: 'https://userdcar-server.hnxinyouhe.com/upload?scene='+scene,
|
||||
url: 'https://userdcar-server.hnxinyouhe.com/upload?scene=' + scene,
|
||||
filePath: imgUrl,
|
||||
name: 'file',
|
||||
header:{'Fdesk-Auth-Token': uni.getStorageSync('token'),'Fdesk-Login-Type': 'feishu','Fdesk-System-Code':'fdesk'},
|
||||
header: {
|
||||
'Fdesk-Auth-Token': uni.getStorageSync('token'),
|
||||
'Fdesk-Login-Type': 'feishu',
|
||||
'Fdesk-System-Code': 'fdesk'
|
||||
},
|
||||
success: (uploadFileRes) => {
|
||||
const res = JSON.parse(uploadFileRes.data || '{}')
|
||||
if(res && res.data && res.data.file_name){
|
||||
if (res && res.data && res.data.file_name) {
|
||||
resolve(res.data.file_name)
|
||||
}else{
|
||||
reject('上传失败')
|
||||
} else {
|
||||
reject(res)
|
||||
}
|
||||
},
|
||||
fail: (err) => reject(err)
|
||||
@@ -426,18 +442,81 @@ export default {
|
||||
return this.uploadFileByScene(path, 'usedcarfile')
|
||||
},
|
||||
|
||||
|
||||
// H5:选择产品图片(绕过 file-picker 在 H5 端可能一次只能选 9 张的限制)
|
||||
pickImagesH5() {
|
||||
const allowCount = this.maxMedia - (this.carinfo.images?.length || 0)
|
||||
// if (allowCount <= 0) {
|
||||
// uni.showToast({
|
||||
// title: `最多只能上传${this.maxMedia}张图片`,
|
||||
// icon: 'none'
|
||||
// })
|
||||
// return
|
||||
// }
|
||||
if (this._uploading) return
|
||||
this._uploading = true
|
||||
uni.chooseFile({
|
||||
count: allowCount,
|
||||
extension: ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'],
|
||||
success: (res) => {
|
||||
const paths = (res.tempFilePaths || []).slice(0, allowCount)
|
||||
if (!paths.length) {
|
||||
this._uploading = false
|
||||
return
|
||||
}
|
||||
// 预览占位:先把本地临时路径塞进 fileList
|
||||
const startAt = this.carinfo.images.length
|
||||
paths.forEach((p, i) => {
|
||||
this.carinfo.images.push('__PENDING__')
|
||||
this.fileList.push({
|
||||
url: p,
|
||||
name: `img_${startAt + i + 1}`
|
||||
})
|
||||
})
|
||||
Promise.all(paths.map(p => this.uploadImage(p)))
|
||||
.then(keys => {
|
||||
keys.forEach((key, i) => this.$set(this.carinfo.images, startAt + i,
|
||||
String(key)))
|
||||
})
|
||||
.catch((e) => {
|
||||
// 回滚
|
||||
this.carinfo.images.splice(startAt, paths.length)
|
||||
this.fileList.splice(startAt, paths.length)
|
||||
uni.showToast({
|
||||
title: e.message,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this._uploading = false
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
this._uploading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// H5:删除产品图(同时删回显列表与提交数组)
|
||||
deleteImageAt(index) {
|
||||
this.carinfo.images.splice(index, 1)
|
||||
this.fileList.splice(index, 1)
|
||||
},
|
||||
// 图片选择
|
||||
selectMedia(e) {
|
||||
const allowCount = this.maxMedia - (this.carinfo.images?.length || 0)
|
||||
if (allowCount <= 0) {
|
||||
uni.showToast({ title: `最多只能上传${this.maxMedia}张图片`, icon: 'none' })
|
||||
uni.showToast({
|
||||
title: `最多只能上传${this.maxMedia}张图片`,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const tempFiles = e.tempFiles || []
|
||||
const tempFilePaths = (tempFiles.length
|
||||
? tempFiles.map(f => f.path || f.url).filter(Boolean)
|
||||
: (e.tempFilePaths || [])
|
||||
const tempFilePaths = (tempFiles.length ?
|
||||
tempFiles.map(f => f.path || f.url).filter(Boolean) :
|
||||
(e.tempFilePaths || [])
|
||||
)
|
||||
const paths = tempFilePaths.slice(0, allowCount)
|
||||
if (paths.length === 0) return
|
||||
@@ -452,14 +531,19 @@ export default {
|
||||
.then(keys => {
|
||||
keys.forEach((key, i) => this.$set(this.carinfo.images, startAt + i, String(key)))
|
||||
})
|
||||
.catch(() => {
|
||||
.catch((e) => {
|
||||
this.carinfo.images.splice(startAt, paths.length)
|
||||
if (Array.isArray(this.fileList) && this.fileList.length >= startAt + paths.length) {
|
||||
this.fileList.splice(startAt, paths.length)
|
||||
}
|
||||
uni.showToast({ title: '图片上传失败,请重试', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: e.message,
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this._uploading = false
|
||||
})
|
||||
.finally(() => { this._uploading = false })
|
||||
},
|
||||
|
||||
delfn(e) {
|
||||
@@ -470,14 +554,17 @@ export default {
|
||||
selectMedia1(e) {
|
||||
const allowCount = this.maxMedia - (this.carinfo.attachment?.length || 0)
|
||||
if (allowCount <= 0) {
|
||||
uni.showToast({ title: `最多只能上传${this.maxMedia}个附件`, icon: 'none' })
|
||||
uni.showToast({
|
||||
title: `最多只能上传${this.maxMedia}个附件`,
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
const tempFiles = e.tempFiles || []
|
||||
const tempFilePaths = (tempFiles.length
|
||||
? tempFiles.map(f => f.path || f.url).filter(Boolean)
|
||||
: (e.tempFilePaths || [])
|
||||
const tempFilePaths = (tempFiles.length ?
|
||||
tempFiles.map(f => f.path || f.url).filter(Boolean) :
|
||||
(e.tempFilePaths || [])
|
||||
)
|
||||
const paths = tempFilePaths.slice(0, allowCount)
|
||||
if (paths.length === 0) return
|
||||
@@ -495,9 +582,14 @@ export default {
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
uni.showToast({ title: '附件上传失败,请重试', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: '附件上传失败,请重试',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this._uploadingFiles = false
|
||||
})
|
||||
.finally(() => { this._uploadingFiles = false })
|
||||
},
|
||||
|
||||
delfn1(e) {
|
||||
@@ -508,7 +600,10 @@ export default {
|
||||
onBindByName() {
|
||||
const name = String(this.carinfo.product_name || '').trim()
|
||||
if (!name) {
|
||||
uni.showToast({ title: '请先输入产品名称', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: '请先输入产品名称',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -523,15 +618,23 @@ export default {
|
||||
request({
|
||||
url: 'common/usedcar/crawl',
|
||||
method: 'get',
|
||||
data: { keyword: name }
|
||||
data: {
|
||||
keyword: name
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.code === 200) {
|
||||
this.bindState.list = res.data.data?.model || []
|
||||
} else {
|
||||
uni.showToast({ title: res.data.message || '拉取失败', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: res.data.message || '拉取失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.showToast({ title: '拉取产品失败,请稍后重试', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: '拉取产品失败,请稍后重试',
|
||||
icon: 'none'
|
||||
})
|
||||
}).finally(() => {
|
||||
this.bindState.loading = false
|
||||
})
|
||||
@@ -572,10 +675,15 @@ export default {
|
||||
this.carinfo.crawl_year = it.year || ''
|
||||
this.carinfo.crawl_msrp = it.msrp || ''
|
||||
this.carinfo.crawl_car_id = it.car_id || ''
|
||||
this.carinfo.crawl_brand_id = it.brand_id || ''
|
||||
this.carinfo.crawl_series_id = it.series_id || ''
|
||||
|
||||
this.bindState.boundProduct = it
|
||||
this.closeBindDialog()
|
||||
uni.showToast({ title: '绑定成功', icon: 'none' })
|
||||
uni.showToast({
|
||||
title: '绑定成功',
|
||||
icon: 'none'
|
||||
})
|
||||
},
|
||||
|
||||
clearBind() {
|
||||
@@ -586,6 +694,8 @@ export default {
|
||||
this.carinfo.crawl_year = ''
|
||||
this.carinfo.crawl_msrp = ''
|
||||
this.carinfo.crawl_car_id = ''
|
||||
this.carinfo.crawl_brand_id = ''
|
||||
this.carinfo.crawl_series_id = ''
|
||||
},
|
||||
|
||||
// ========== 提交 ==========
|
||||
@@ -621,72 +731,125 @@ export default {
|
||||
crawl_series: payload.crawl_series,
|
||||
crawl_year: payload.crawl_year,
|
||||
crawl_msrp: payload.crawl_msrp,
|
||||
crawl_car_id: payload.crawl_car_id
|
||||
crawl_car_id: payload.crawl_car_id,
|
||||
crawl_brand_id: payload.crawl_brand_id,
|
||||
crawl_series_id: payload.crawl_series_id
|
||||
}
|
||||
}).then(res => {
|
||||
uni.showToast({ title: res.data.message, icon: 'none' })
|
||||
uni.showToast({
|
||||
title: res.data.message,
|
||||
icon: 'none'
|
||||
})
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/index/mine' })
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/mine'
|
||||
})
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.uniui-right{ position:absolute; top:2px; }
|
||||
.red{ color:red; }
|
||||
.content{ margin:20px 12px; background:#FFFFFF; border-radius:10px; }
|
||||
.zw{ height:120px; }
|
||||
.cont{ position:relative; padding:18px 20px; align-items:center; font-weight:500; }
|
||||
.conts{ margin-bottom:20rpx; }
|
||||
.media-upload-wrapper{ display:flex; flex-wrap:wrap; gap:16rpx; }
|
||||
.pages {
|
||||
max-width: 650px;
|
||||
}
|
||||
|
||||
.cell{
|
||||
.uniui-right {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.content {
|
||||
margin: 20px 12px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.zw {
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
.cont {
|
||||
position: relative;
|
||||
padding: 18px 20px;
|
||||
align-items: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.conts {
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.media-upload-wrapper {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.cell {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 18px 20px;
|
||||
align-items: center;
|
||||
font-weight: 500;
|
||||
}
|
||||
.cont::after, .cell::after{
|
||||
content:'';
|
||||
position:absolute;
|
||||
width:200%;
|
||||
height:200%;
|
||||
top:0;
|
||||
left:0;
|
||||
transform-origin:0 0;
|
||||
border-width:0;
|
||||
border-bottom-width:1px;
|
||||
border-style:solid;
|
||||
transform:scale(0.5,0.5);
|
||||
border-radius:1px;
|
||||
box-sizing:border-box;
|
||||
pointer-events:none;
|
||||
border-color:#C3C3C3;
|
||||
}
|
||||
.right{ text-align:right; }
|
||||
.btn{
|
||||
background-color:#3F435B;
|
||||
color:white;
|
||||
border-radius:50px;
|
||||
width:92%;
|
||||
margin:15px 4%;
|
||||
}
|
||||
.addimg{ width:215rpx; height:215rpx; }
|
||||
}
|
||||
|
||||
/* 产品名称 + 绑定按钮 */
|
||||
.right-bind{
|
||||
.cont::after,
|
||||
.cell::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
transform-origin: 0 0;
|
||||
border-width: 0;
|
||||
border-bottom-width: 1px;
|
||||
border-style: solid;
|
||||
transform: scale(0.5, 0.5);
|
||||
border-radius: 1px;
|
||||
box-sizing: border-box;
|
||||
pointer-events: none;
|
||||
border-color: #C3C3C3;
|
||||
}
|
||||
|
||||
.right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.btn {
|
||||
background-color: #3F435B;
|
||||
color: white;
|
||||
border-radius: 50px;
|
||||
width: 92%;
|
||||
margin: 15px 4%;
|
||||
}
|
||||
|
||||
.addimg {
|
||||
width: 215rpx;
|
||||
height: 215rpx;
|
||||
}
|
||||
|
||||
/* 产品名称 + 绑定按钮 */
|
||||
.right-bind {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
width: 70%;
|
||||
}
|
||||
.right-bind .inp{ flex:1; }
|
||||
.bind-btn{
|
||||
}
|
||||
|
||||
.right-bind .inp {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.bind-btn {
|
||||
margin-left: 16rpx;
|
||||
padding: 0 18rpx;
|
||||
height: 56rpx;
|
||||
@@ -695,8 +858,9 @@ export default {
|
||||
background: #2E6CF6;
|
||||
color: #fff;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.bind-tip{
|
||||
}
|
||||
|
||||
.bind-tip {
|
||||
margin: 0 24rpx 16rpx;
|
||||
padding: 12rpx 18rpx;
|
||||
border-radius: 12rpx;
|
||||
@@ -704,12 +868,20 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bind-tip-text{ color:#2B3A55; font-size:24rpx; }
|
||||
.bind-tip-clear{ color:#2E6CF6; font-size:24rpx; }
|
||||
}
|
||||
|
||||
/* 弹框搜索 */
|
||||
.bind-search{
|
||||
.bind-tip-text {
|
||||
color: #2B3A55;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.bind-tip-clear {
|
||||
color: #2E6CF6;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
/* 弹框搜索 */
|
||||
.bind-search {
|
||||
margin: 5px 24rpx 16rpx;
|
||||
padding: 12rpx 18rpx;
|
||||
border-radius: 12rpx;
|
||||
@@ -717,92 +889,112 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bind-search-input{
|
||||
}
|
||||
|
||||
.bind-search-input {
|
||||
flex: 1;
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
}
|
||||
.bind-search-placeholder{
|
||||
}
|
||||
|
||||
.bind-search-placeholder {
|
||||
color: #9AA6BF;
|
||||
}
|
||||
.bind-search-clear{
|
||||
}
|
||||
|
||||
.bind-search-clear {
|
||||
margin-left: 16rpx;
|
||||
font-size: 24rpx;
|
||||
color: #2E6CF6;
|
||||
}
|
||||
/* 绑定弹框 */
|
||||
.bind-mask{
|
||||
}
|
||||
|
||||
/* 绑定弹框 */
|
||||
.bind-mask {
|
||||
position: fixed;
|
||||
left: 0; right: 0; top: 0; bottom: 0;
|
||||
background: rgba(0,0,0,0.45);
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
z-index: 999;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 40rpx;
|
||||
}
|
||||
.bind-dialog{
|
||||
}
|
||||
|
||||
.bind-dialog {
|
||||
width: 100%;
|
||||
max-width: 680rpx;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
.bind-dialog-head{
|
||||
}
|
||||
|
||||
.bind-dialog-head {
|
||||
height: 96rpx;
|
||||
padding: 0 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
.bind-dialog-title{
|
||||
}
|
||||
|
||||
.bind-dialog-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #111;
|
||||
}
|
||||
.bind-dialog-close{
|
||||
}
|
||||
|
||||
.bind-dialog-close {
|
||||
font-size: 40rpx;
|
||||
color: #999;
|
||||
line-height: 1;
|
||||
}
|
||||
.bind-dialog-body{
|
||||
}
|
||||
|
||||
.bind-dialog-body {
|
||||
max-height: 720rpx;
|
||||
padding: 12rpx 0;
|
||||
}
|
||||
.bind-loading,.bind-empty{
|
||||
}
|
||||
|
||||
.bind-loading,
|
||||
.bind-empty {
|
||||
padding: 40rpx 24rpx;
|
||||
color: #888;
|
||||
text-align: center;
|
||||
font-size: 26rpx;
|
||||
}
|
||||
.bind-item{
|
||||
}
|
||||
|
||||
.bind-item {
|
||||
padding: 18rpx 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.bind-item.active{
|
||||
}
|
||||
|
||||
.bind-item.active {
|
||||
background: #F3F6FF;
|
||||
}
|
||||
.bind-item-main{
|
||||
}
|
||||
|
||||
.bind-item-main {
|
||||
flex: 1;
|
||||
padding-right: 16rpx;
|
||||
}
|
||||
.bind-item-title{
|
||||
}
|
||||
|
||||
.bind-item-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: #222;
|
||||
display: block;
|
||||
}
|
||||
.bind-item-sub{
|
||||
}
|
||||
|
||||
.bind-item-sub {
|
||||
margin-top: 6rpx;
|
||||
font-size: 24rpx;
|
||||
color: #777;
|
||||
display: block;
|
||||
}
|
||||
.bind-item-check{
|
||||
}
|
||||
|
||||
.bind-item-check {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
border-radius: 50%;
|
||||
@@ -810,20 +1002,23 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.check-dot{
|
||||
}
|
||||
|
||||
.check-dot {
|
||||
width: 22rpx;
|
||||
height: 22rpx;
|
||||
border-radius: 50%;
|
||||
background: #2E6CF6;
|
||||
}
|
||||
.bind-dialog-foot{
|
||||
}
|
||||
|
||||
.bind-dialog-foot {
|
||||
padding: 16rpx 24rpx 22rpx;
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
}
|
||||
.btn{
|
||||
}
|
||||
|
||||
.btn {
|
||||
flex: 1;
|
||||
height: 76rpx;
|
||||
border-radius: 16rpx;
|
||||
@@ -831,16 +1026,73 @@ export default {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.btn-ghost{
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: #F5F6F8;
|
||||
color: #333;
|
||||
}
|
||||
.btn-primary{
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: #2E6CF6;
|
||||
color: #fff;
|
||||
}
|
||||
.btn-primary.disabled{
|
||||
}
|
||||
|
||||
.btn-primary.disabled {
|
||||
opacity: .45;
|
||||
}
|
||||
}
|
||||
|
||||
/* H5 产品图网格(替代 uni-file-picker 的选择入口,支持累计到 20 张) */
|
||||
.h5-img-grid {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8rpx;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.h5-img-item {
|
||||
position: relative;
|
||||
width: 32%;
|
||||
height: 200rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.h5-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.h5-img-del {
|
||||
position: absolute;
|
||||
right: 8rpx;
|
||||
top: 8rpx;
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
line-height: 44rpx;
|
||||
text-align: center;
|
||||
border-radius: 999rpx;
|
||||
background: rgba(0, 0, 0, .55);
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.h5-img-add {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 32%;
|
||||
height: 200rpx;
|
||||
border-radius: 12rpx;
|
||||
border: 1px dashed #cfcfcf;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.h5-img-count {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
</style>
|
||||
@@ -92,7 +92,7 @@
|
||||
const res = await request({
|
||||
url: 'common/auth/login',
|
||||
method: 'POST',
|
||||
data: { feishu_code: code,app_id:uni.getStorageSync('fsappid')}
|
||||
data: { feishu_code: code,app_id:uni.getStorageSync('fsappid'),is_pc:0}
|
||||
})
|
||||
|
||||
const token = res?.data?.data?.union_id
|
||||
|
||||
@@ -72,12 +72,12 @@
|
||||
async silentAuth() {
|
||||
try {
|
||||
// 1) 如果本地已有 token,直接进首页(丝滑)
|
||||
const token = uni.getStorageSync('token')
|
||||
if (token) {
|
||||
this.title = '已登录'
|
||||
this.desc = '正在进入页面'
|
||||
return this.goRedirectSmooth()
|
||||
}
|
||||
// const token = uni.getStorageSync('token')
|
||||
// if (token) {
|
||||
// this.title = '已登录'
|
||||
// this.desc = '正在进入页面'
|
||||
// return this.goRedirectSmooth()
|
||||
// }
|
||||
|
||||
// 2) 获取飞书授权跳转地址(静默授权/免登)
|
||||
this.title = '正在跳转飞书授权'
|
||||
@@ -85,7 +85,7 @@
|
||||
const res = await request({
|
||||
url: 'common/auth/feishu/scope',
|
||||
method: 'get',
|
||||
data:{app_id:this.fsappid}
|
||||
data:{app_id:this.fsappid,is_pc:0}
|
||||
})
|
||||
const auth_url = res?.data?.data?.auth_url
|
||||
if (!auth_url) {
|
||||
|
||||
Reference in New Issue
Block a user