|
|
@ -41,27 +41,27 @@ |
|
|
|
<u-icon slot="right" name="arrow-right"></u-icon> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="年限" prop="date" @click="showDate=true"> |
|
|
|
<u--input border="bottom" v-model="form.date" readonly placeholder="请填写年限"></u--input> |
|
|
|
<u--input border="bottom" type="number" v-model="form.date" readonly placeholder="请填写年限"></u--input> |
|
|
|
<u-icon slot="right" name="arrow-right"></u-icon> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="公里数" prop="mileage"> |
|
|
|
<u--input v-model="form.mileage" type="number" placeholder="请填写公里数"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="价格" prop="price"> |
|
|
|
<u--input v-model="form.price" placeholder="请填写价格"></u--input> |
|
|
|
<u--input v-model="form.price" type="number" placeholder="请填写价格"></u--input> |
|
|
|
<div slot="right" class="se-c-green">¥ <text v-if="form.cartypeName=='租赁车辆'">/月</text> </div> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="库存" prop="inventory"> |
|
|
|
<u--input v-model="form.inventory" type="number" placeholder="请填写库存"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="联系人" prop="contacts"> |
|
|
|
<u--input v-model="form.contacts" placeholder="请填写联系人"></u--input> |
|
|
|
<u--input v-model="form.contacts" type="text" placeholder="请填写联系人"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="联系人电话" prop="phone"> |
|
|
|
<u--input v-model="form.phone" type="number" placeholder="请填写电话"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item label="浏览量" prop="views"> |
|
|
|
<u--input v-model="form.views" placeholder="请填写浏览量"></u--input> |
|
|
|
<u--input v-model="form.views" type="number" placeholder="请填写浏览量"></u--input> |
|
|
|
</u-form-item> |
|
|
|
<u-form-item prop="fileCarList" labelWidth="0"> |
|
|
|
<view class="se-flex se-flex-v-sa"> |
|
|
@ -132,22 +132,23 @@ |
|
|
|
<view class="se-px-20 se-pb-80 se-fs-20 se-flex"> |
|
|
|
<view @click="onSubmit" |
|
|
|
class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-green"> |
|
|
|
<text>发布订单</text> |
|
|
|
<text>提交订单</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</u-form-item> |
|
|
|
|
|
|
|
</u--form> |
|
|
|
|
|
|
|
<u-datetime-picker |
|
|
|
<u-picker :show="showDate" :columns="columns" @confirm="onConfirm" |
|
|
|
@cancel="onCancel"></u-picker> |
|
|
|
<!-- <u-datetime-picker |
|
|
|
:maxDate="maxDate" |
|
|
|
:show="showDate" |
|
|
|
v-model="date" |
|
|
|
mode="date" |
|
|
|
mode="year" |
|
|
|
@confirm="onConfirm" |
|
|
|
@cancel="onCancel" |
|
|
|
></u-datetime-picker> |
|
|
|
></u-datetime-picker> --> |
|
|
|
<u-action-sheet :actions="categoryOneList" @select="selectCategoryOneClick" title="分类" :show="categoryOneShow" @close="categoryOneShow=false"></u-action-sheet> |
|
|
|
<u-action-sheet :actions="categoryTwoList" @select="selectCategoryTwoClick" title="分类" :show="categoryTwoShow" @close="categoryTwoShow=false"></u-action-sheet> |
|
|
|
</view> |
|
|
@ -158,7 +159,7 @@ |
|
|
|
const startOfToday = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime(); |
|
|
|
const startOfYesterday = startOfToday - 24 * 60 * 60 * 1000; |
|
|
|
|
|
|
|
import { queryTypeList,addGoods,queryCategoryOneList,queryCategoryTwoList,queryCategoryList } from "@/common/api.js" |
|
|
|
import { queryTypeList,addGoods,queryCategoryOneList,queryCategoryTwoList,queryCategoryList,queryGoodsById } from "@/common/api.js" |
|
|
|
import QQMapWX from "@/util/qqmap-wx-jssdk.min.js" |
|
|
|
export default { |
|
|
|
components:{ |
|
|
@ -166,6 +167,8 @@ |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
id:null, |
|
|
|
columns:[['2025', '2024', '2023', '2022', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2002', '2001', '2000']], |
|
|
|
maxDate:startOfYesterday, |
|
|
|
actions:[], |
|
|
|
showType:false, |
|
|
@ -237,12 +240,14 @@ |
|
|
|
// } |
|
|
|
// ],//车辆照片右 |
|
|
|
// fileCabList:[ |
|
|
|
// { |
|
|
|
// url:"https://tennis-oss.xzaiyp.top/2024-12-14/7e98056b-e0b9-496f-89f8-88026ce9426e.png" |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// url:"https://tennis-oss.xzaiyp.top/2024-12-14/499fcd8a-3d4b-42f3-b023-61bac6b1c020.png" |
|
|
|
// } |
|
|
|
// { |
|
|
|
// status:1, |
|
|
|
// url:"https://tennis-oss.xzaiyp.top/2024-12-14/7e98056b-e0b9-496f-89f8-88026ce9426e.png" |
|
|
|
// }, |
|
|
|
// { |
|
|
|
// status:0, |
|
|
|
// url:"https://tennis-oss.xzaiyp.top/2024-12-14/499fcd8a-3d4b-42f3-b023-61bac6b1c020.png" |
|
|
|
// } |
|
|
|
// ],//车辆照片 驾驶室 |
|
|
|
// introduce:`车型名称:车辆的品牌和型号,例如 "Toyota Corolla 2024"。 |
|
|
|
// 车辆类型:轿车、SUV、MPV、皮卡、跑车等。 |
|
|
@ -279,7 +284,6 @@ |
|
|
|
rules: { |
|
|
|
typeId:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择类型', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -287,7 +291,6 @@ |
|
|
|
], |
|
|
|
goodsName:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写标题', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -295,7 +298,6 @@ |
|
|
|
], |
|
|
|
brand:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写品牌', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -303,7 +305,6 @@ |
|
|
|
], |
|
|
|
model:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写型号', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -311,7 +312,6 @@ |
|
|
|
], |
|
|
|
area:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请选择所在地区', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -319,7 +319,6 @@ |
|
|
|
], |
|
|
|
date:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写时间', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -327,7 +326,6 @@ |
|
|
|
], |
|
|
|
mileage:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写公里数', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -335,23 +333,20 @@ |
|
|
|
], |
|
|
|
price:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写价格', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
trigger: ['blur'] |
|
|
|
} |
|
|
|
], |
|
|
|
inventory:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写库存', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
trigger: ['blur'] |
|
|
|
} |
|
|
|
], |
|
|
|
contacts:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写联系人', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -359,7 +354,6 @@ |
|
|
|
], |
|
|
|
phone:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写联系电话', |
|
|
|
trigger: ['blur', 'change'] |
|
|
@ -367,10 +361,9 @@ |
|
|
|
], |
|
|
|
views:[ |
|
|
|
{ |
|
|
|
type: 'string', |
|
|
|
required: true, |
|
|
|
message: '请填写浏览量', |
|
|
|
trigger: ['blur', 'change'] |
|
|
|
trigger: ['blur'] |
|
|
|
} |
|
|
|
], |
|
|
|
fileCarList:[ |
|
|
@ -450,24 +443,79 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
let that = this |
|
|
|
|
|
|
|
if(options.id){ |
|
|
|
that.id = options.id |
|
|
|
that.getQueryGoodsById() |
|
|
|
}else{ |
|
|
|
that.onQueryCategoryList() |
|
|
|
} |
|
|
|
// this.onQueryTypeList() |
|
|
|
// this.onQueryCategoryOneList() |
|
|
|
// this.onQueryCategoryTwoList() |
|
|
|
this.onQueryCategoryList() |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
// "form.categorytwoId": function (newVal, oldVal) { |
|
|
|
// if (newVal) { |
|
|
|
// this.$nextTick(() => { |
|
|
|
// this.form.categorytwoName = this.categoryTwoList |
|
|
|
// .filter((item) => item.id == newVal) |
|
|
|
// .map((item) => item.name) |
|
|
|
// .join(''); |
|
|
|
// }); |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getQueryGoodsById(){ |
|
|
|
let that = this |
|
|
|
queryGoodsById({goodsId:that.id}).then(response=>{ |
|
|
|
let items = response.result; |
|
|
|
console.info("queryGoodsById",response) |
|
|
|
that.form.cartypeId=items.cartypeId |
|
|
|
that.form.categorytwoId=items.categorytwoId |
|
|
|
that.form.categorytwoName=items.categorytwoName |
|
|
|
that.form.goodsName=items.goodsName |
|
|
|
that.form.brand=items.brand |
|
|
|
that.form.model=items.model |
|
|
|
that.form.area=items.area |
|
|
|
that.form.latitude=items.latitude |
|
|
|
that.form.date=String(items.goodsTime) |
|
|
|
that.form.inventory=String(items.inventory) |
|
|
|
that.form.mileage=String(items.mileage) |
|
|
|
that.form.contacts=items.userName |
|
|
|
that.form.phone=items.phone |
|
|
|
that.form.price=String(items.price) |
|
|
|
that.form.views=String(items.views) |
|
|
|
that.form.introduce=items.detail |
|
|
|
that.form.fileCarList=items.image.split(',').map((url) => ({ url })) |
|
|
|
that.form.fileBackList=items.imageBack.split(',').map((url) => ({ url })) |
|
|
|
that.form.fileCabList=items.imageCab.split(',').map((url) => ({ url })) |
|
|
|
that.form.fileFrontList=items.imageFront.split(',').map((url) => ({ url })) |
|
|
|
that.form.fileLeftList=items.imageLeft.split(',').map((url) => ({ url })) |
|
|
|
that.form.fileRightList=items.imageRight.split(',').map((url) => ({ url })) |
|
|
|
that.onQueryCategoryList() |
|
|
|
|
|
|
|
// this.$refs.uForm.setRules(this.rules) |
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|
}, |
|
|
|
onQueryCategoryList(){ |
|
|
|
let that = this |
|
|
|
queryCategoryList({}).then(response=>{ |
|
|
|
console.info("queryCategoryList",response) |
|
|
|
if(response.result.length>0){ |
|
|
|
that.categoryList = response.result |
|
|
|
that.form.cartypeId = response.result[0].id |
|
|
|
that.form.cartypeName = response.result[0].name |
|
|
|
that.categoryTwoList = response.result[0].carrentCategorytwoList |
|
|
|
if(!that.id){ |
|
|
|
that.form.cartypeId = response.result[0].id |
|
|
|
that.form.cartypeName = response.result[0].name |
|
|
|
that.categoryTwoList = response.result[0].carrentCategorytwoList |
|
|
|
}else{ |
|
|
|
that.categoryTwoList = response.result.find(item => item.id == that.form.cartypeId).carrentCategorytwoList |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(error=>{ |
|
|
@ -530,12 +578,14 @@ |
|
|
|
}, |
|
|
|
onConfirm(e){ |
|
|
|
console.info('e',e) |
|
|
|
const date = new Date(e.value); |
|
|
|
const year = date.getFullYear(); |
|
|
|
const month = String(date.getMonth() + 1).padStart(2, '0'); |
|
|
|
const day = String(date.getDate()).padStart(2, '0'); |
|
|
|
this.form.date = `${year}-${month}-${day}`; |
|
|
|
this.form.date = e.value[0]; |
|
|
|
this.showDate = false |
|
|
|
// const date = new Date(e.value); |
|
|
|
// const year = date.getFullYear(); |
|
|
|
// const month = String(date.getMonth() + 1).padStart(2, '0'); |
|
|
|
// const day = String(date.getDate()).padStart(2, '0'); |
|
|
|
// this.form.date = `${year}-${month}-${day}`; |
|
|
|
// this.showDate = false |
|
|
|
}, |
|
|
|
handleAreaChange(){ |
|
|
|
const that = this; |
|
|
@ -661,7 +711,7 @@ |
|
|
|
}) |
|
|
|
}, |
|
|
|
onSubmit() { |
|
|
|
// console.info(this.form) |
|
|
|
console.info(this.form) |
|
|
|
// uni.navigateTo({ |
|
|
|
// url:"/pages_subpack/success/index" |
|
|
|
// }) |
|
|
@ -676,9 +726,8 @@ |
|
|
|
onAddGoods(){ |
|
|
|
let that = this |
|
|
|
let params={ |
|
|
|
id:that.id?that.id:null, |
|
|
|
cartypeId:that.form.cartypeId, |
|
|
|
// categorytwoId:"1867040891523936258", |
|
|
|
// cartypeId:that.form.typeId, |
|
|
|
categorytwoId:that.form.categorytwoId, |
|
|
|
goodsName:that.form.goodsName,//商品名称 |
|
|
|
brand:that.form.brand,//品牌 |
|
|
@ -686,7 +735,7 @@ |
|
|
|
area:that.form.area,//所在区域 |
|
|
|
latitude:that.form.latitude, |
|
|
|
longitude:that.form.longitude, |
|
|
|
goodsTime:that.form.date,//时间 |
|
|
|
goodsTime:Number(that.form.date),//时间 |
|
|
|
inventory:that.form.inventory,//库存 |
|
|
|
mileage:that.form.mileage,//公里数 |
|
|
|
userName:that.form.contacts,//联系人 |
|
|
@ -701,19 +750,30 @@ |
|
|
|
imageRight:that.form.fileRightList.map(item => item.url).join(','),//车辆照片(右) |
|
|
|
detail:that.form.introduce,//车辆介绍 |
|
|
|
} |
|
|
|
uni.showLoading({ |
|
|
|
title:"提交中..." |
|
|
|
}) |
|
|
|
addGoods(params).then(response=>{ |
|
|
|
console.info('response',response) |
|
|
|
uni.showToast({ |
|
|
|
title: response.message, |
|
|
|
mask: false, |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
|
url:"/pages/home/index" |
|
|
|
uni.hideLoading() |
|
|
|
if(that.id){ |
|
|
|
uni.navigateBack({ |
|
|
|
delta:1 |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
}else{ |
|
|
|
uni.showToast({ |
|
|
|
title: response.message, |
|
|
|
mask: false, |
|
|
|
icon: 'none', |
|
|
|
duration: 2000 |
|
|
|
}) |
|
|
|
setTimeout(()=>{ |
|
|
|
uni.switchTab({ |
|
|
|
url:"/pages/home/index" |
|
|
|
}) |
|
|
|
},1500) |
|
|
|
} |
|
|
|
|
|
|
|
}).catch(error=>{ |
|
|
|
|
|
|
|
}) |
|
|
|