This commit is contained in:
2026-10-08 18:20:51 +08:00
parent dec4ebc773
commit 6f1b2dc03a
621 changed files with 47117 additions and 43176 deletions
+1385 -1044
View File
File diff suppressed because it is too large Load Diff
+587 -384
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+260 -206
View File
@@ -1,236 +1,290 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<!-- <view class="page-nav">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item><navigator url="/pages/spot/goods/goods">现货市场</navigator></el-breadcrumb-item>
</el-breadcrumb>
</view> -->
<!-- <view class="page-nav">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item><navigator url="/pages/spot/goods/goods">现货市场</navigator></el-breadcrumb-item>
</el-breadcrumb>
</view> -->
<view class="carousel">
<el-carousel height="170px">
<el-carousel-item v-for="item in 4" :key="item">
<image class="carousel-img"
src="/static/images/600fc93e6b85324b3ea1373ee264290d.jpg"
mode="aspectFill"></image>
</el-carousel-item>
</el-carousel>
<view class="goods-options">
<el-row class="">
<el-button @click="toRelease" type="primary" round>发布旧货交易</el-button>
<!-- <el-button type="primary" round plain>我发布的询价单</el-button> -->
</el-row>
</view>
</view>
<view class="carousel">
<!-- <el-carousel height="170px">-->
<!-- <el-carousel-item v-for="item in 4" :key="item">-->
<!-- <image class="carousel-img"-->
<!-- src="/static/images/600fc93e6b85324b3ea1373ee264290d.jpg"-->
<!-- mode="aspectFill"></image>-->
<!-- </el-carousel-item>-->
<!-- </el-carousel>-->
<common-swiper page="old-mine" :height="200"/>
<view class="goods-options">
<el-row class="">
<el-button @click="toRelease" type="primary" round>发布旧货交易</el-button>
<!-- <el-button type="primary" round plain>我发布的询价单</el-button> -->
</el-row>
</view>
</view>
<!-- 商品列表 -->
<view class="sheet-list">
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :customRightBtns="table1.customRightBtns"
:pagination="true" :query-form-param="queryForm1"></vk-data-table>
</view>
<!-- 商品列表 -->
<view class="sheet-list">
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns"
:customRightBtns="table1.customRightBtns"
:pagination="true" :query-form-param="queryForm1"></vk-data-table>
</view>
<common-footer></common-footer>
</view>
<common-footer></common-footer>
</view>
</template>
<script>
export default {
data() {
return {
keyword: '',
// 表格相关开始 -----------------------------------------------------------
queryForm1: {
formData: {
userId: vk.getVuex('$user.userInfo._id')
},
columns: [
{ key:"userId", title:"发布人ID", type:"text", width:160, mode:"=" },
]
},
table1: {
// 表格数据请求地址
action: "client/old/kh/getList",
customRightBtns: [
{
title: '详情',
icon: 'el-icon-search',
type: 'primary',
onClick: (item) => {
vk.navigateTo('/pages/index/old/detail?id=' + item._id);
}
},
{
title: '删除',
icon: 'el-icon-delete',
type: 'primary',
onClick: (item) => {
this.$confirm('').then(()=> {
}).then(() => {
vk.callFunction({
url: 'client/old/kh/delete',
title: '请求中...',
data: {
id: item._id
},
}).then(res => {
this.$refs.table1.refresh()
})
})
}
},
],
// 表格字段显示规则
columns: [
{
key: "标题",
title: "title",
type: "text",
width: 280
},
{
key: "productList",
title: "所在地",
type: "text",
minWidth: 200,
formatter: (val, row, column, index) => {
let str = ""
try {
str = val.map(item=>{
return item.addressRegion[0].name + "-" + item.addressRegion[1].name
}).join("/")
} catch(err){
str = ""
}
return str
}
},
{
key: "supplier.companyName",
title: "供应商",
type: "text",
},
{
key: "_add_time_srt",
title: "添加时间",
type: "time",
width: 160
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
export default {
data() {
return {
keyword: '',
// 表格相关开始 -----------------------------------------------------------
queryForm1: {
formData: {
userId: vk.getVuex('$user.userInfo._id')
},
columns: [
{key: "userId", title: "发布人ID", type: "text", width: 160, mode: "="},
]
},
table1: {
// 表格数据请求地址
action: "client/old/kh/getList",
customRightBtns: [
{
title: '详情',
icon: 'el-icon-search',
type: 'primary',
onClick: (item) => {
vk.navigateTo('/pages/index/old/detail?id=' + item._id);
}
},
{
title: '删除',
icon: 'el-icon-delete',
type: 'primary',
onClick: (item) => {
this.$confirm('如果你要删除此条信息,之前其他客户填写的留言将无法查看', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.callFunction({
url: 'client/old/kh/delete',
title: '请求中...',
data: {
id: item._id
},
}).then(res => {
this.$refs.table1.refresh()
})
})
},
show: (item) => {
console.log(item.status)
return item.status === 0
}
},
],
// 表格字段显示规则
columns: [
{
key: "title",
title: "标题",
type: "text",
width: 280
},
{
key: "addressRegion",
title: "所在地",
type: "text",
minWidth: 200,
formatter: (val, row, column, index) => {
let str = ""
try {
if (row.type === 1) str = (row.deliverAddressRegion && row.deliverAddressRegion.city) ? (row.deliverAddressRegion.province.name + "-" + row.deliverAddressRegion.city.name) : ''
else str = (row.addressRegion && row.addressRegion.city) ? (row.addressRegion.province.name + "-" + row.addressRegion.city.name) : ''
},
// 表格相关结束 -----------------------------------------------------------
};
},
onLoad() {
// if (row.type === 2) {
// str = row.offerAddressRegion.province.name + row.offerAddressRegion.city.name + row.offerAddressRegion.area.name
// } else if (row.type === 1) {
// str = row.deliverAddressRegion.province.name + row.deliverAddressRegion.city.name + row.deliverAddressRegion.area.name
// } else {
// str = val.province.name + val.city.name + val.area.name
// }
} catch (err) {
str = ""
}
},
methods: {
toRelease() {
return str
}
},
{
key: "quoteNum",
title: "报价数",
type: "text",
formatter: (val, row, column, index) => {
return `${val}家已报价`
}
},
{
key: "type",
title: "类型",
type: "select",
data: [
{value: 0, label: '拍卖'},
{value: 1, label: '采购'},
{value: 2, label: '租赁'},
{value: 3, label: '物资回收'},
]
},
// {
// key: "supplier",
// title: "供应商",
// type: "text",
// formatter: (val, row, column, index) => {
// console.log(val.companyName, val.companyName === '')
// if (val.companyName && val.companyName !== '') return val.companyName
// else return val.personName
// // console.log((val.companyName && val.companyName !== ''), val.companyName)
// // return ((val.companyName && val.companyName !== '') ? val.companyName : val.personName)
// }
// },
{
key: "_add_time_str",
title: "添加时间",
type: "time",
width: 160
},
if (!vk.getVuex('$user.userInfo.fadadaConfirm')) {
this.$confirm('您尚未认证, 是否前往认证?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.getCertUrl()
})
} else if (vk.pubfn.isNull(vk.getVuex('$user.userInfo.businessCard'))) {
this.$confirm('请完善名片信息', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo('/pages/user/user?menu=business-card');
})
} else {
uni.navigateTo({
url: '/pages/index/old/release'
})
}
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
},
// 表格相关结束 -----------------------------------------------------------
};
},
onLoad() {
},
methods: {
async toRelease() {
const {userInfo, accountNum} = await vk.callFunction({
url: 'user/kh/getMyUserInfo'
})
if (!userInfo.fadadaConfirm || [-1, 2].includes(userInfo.authStatus)) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
} else if (vk.pubfn.isNull(userInfo.businessCard)) {
this.$confirm('您尚未认证和完善名片,是否前往个人中心?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
} else if (accountNum === 0) {
this.$confirm('请先到个人中心添加收款账户', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=account'});
})
} else {
if (userInfo.businessCard.status !== 1) {
this.$confirm('您的名片信息未审核,请耐心等待', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
return
}
vk.navigateTo({
url: '/pages/index/old/release'
})
}
},
},
computed: {
checkCategoryArr() {
let arr = []
this.checkCategoryList.forEach(item => {
arr.push(...item)
})
this.checkProvinceList.forEach(item => {
arr.push({
...item
})
})
return arr
}
},
},
computed: {
checkCategoryArr() {
let arr = []
this.checkCategoryList.forEach(item => {
arr.push(...item)
})
this.checkProvinceList.forEach(item => {
arr.push({
...item
})
})
return arr
}
}
}
}
}
</script>
<style lang="scss" scoped>
.carousel {
width: 1200px;
margin: 20px auto;
}
.carousel {
width: 1200px;
margin: 20px auto;
}
.carousel-img {
width: 100%;
height: 100%;
}
.carousel-img {
width: 100%;
height: 100%;
}
.goods-options {
background-color: #FFFFFF;
padding: 20px;
}
.goods-options {
background-color: #FFFFFF;
padding: 20px;
}
.filter-outer {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 20px;
}
.filter-outer {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 20px;
}
.tags {
display: flex;
.tags {
display: flex;
.el-tag {
margin-right: 10px;
}
}
.el-tag {
margin-right: 10px;
}
}
.sheet-list {
width: 1200px;
margin: 20px auto;
// display: flex;
.sheet-list {
width: 1200px;
margin: 20px auto;
// display: flex;
}
}
.paginatio {
float: none;
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
}
.paginatio {
float: none;
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
}
</style>
+581 -490
View File
File diff suppressed because it is too large Load Diff
+235
View File
@@ -0,0 +1,235 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="page-nav">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>
<navigator style="display: inline-block;" url="/pages/index/old/old">旧货交易</navigator>
</el-breadcrumb-item>
<el-breadcrumb-item>填写报价信息</el-breadcrumb-item>
</el-breadcrumb>
</view>
<view class="page-main">
<quote-remain-num v-if="reloaded" :amount="sheet.quoteAmount" type="old" :id="id"/>
<vk-data-form
ref="form1"
v-model="form1.data"
:action="form1.props.action"
:columns="form1.props.columns"
:rules="form1.props.rules"
:form-type="form1.props.formType"
:loading.sync="form1.props.loading"
:auto-close="false"
label-width="140px"
:show-cancel="false"
@success="onFormSuccess"
>
<template v-slot:totalPrice>
<el-input v-if="sheet.type === 2 && sheet.rentType === 1" v-model="form1.data.totalPrice"
placeholder="请输入询价内容"/>
<el-input v-else v-model="form1.data.totalPrice" placeholder="请输入总价"
@change="formatNumber"></el-input>
</template>
</vk-data-form>
</view>
<common-footer></common-footer>
</view>
</template>
<script>
import dayjs from "dayjs";
export default {
data() {
return {
id: null,
sheet: null,
reloaded: false,
// 表单相关开始-----------------------------------------------------------
form1: {
// 表单请求数据,此处可以设置默认值
data: {
// radio: 1,
// checkbox : [1,2]
sheetId: null
},
// 表单属性
props: {
// 表单请求地址
action: "client/old/kh/addQuote",
// 表单字段显示规则
columns: [
{
key: "totalPrice", title: "总价(人民币:元)", type: "number", showRule: () => {
return this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0)
}
},
{
key: "totalPrice", title: '简述询价内容', type: "number", showRule: () => {
return this.sheet.type === 2 && this.sheet.rentType === 1
}
},
{key: "files", title: "附件", type: "file", accept: '.pdf'},
{
key: "remark", title: "报价单详情", type: "textarea", showRule: () => {
return this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0)
}
},
{
key: "remark", title: "询价详情", type: "textarea", showRule: () => {
return this.sheet.type === 2 && this.sheet.rentType === 1
}
},
{
key: "supplierExt", title: "报价补充条款", type: "textarea", showRule: () => {
return this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0)
}
},
],
// 表单验证规则
rules: {
totalPrice: [
{required: true, message: "总价不能为空", trigger: "change,blur"},
]
},
// add 代表添加 update 代表修改
formType: "",
// 表单是否在请求中
loading: false,
// 是否显示表单1 的弹窗
show: false
}
},
// 表单相关结束-----------------------------------------------------------
};
},
onLoad(options = {}) {
console.log(options)
const {
id
} = options
if (!id) {
vk.navigateTo('/pages/index/old/old');
return
}
this.id = id
this.form1.data.sheetId = id
this.getDetail()
},
computed: {
totalPriceStr() {
if (this.totalPrice === 0) {
return "零元"
}
return vk.myfn.convertCurrency(this.totalPrice / 100)
}
},
methods: {
getDetail() {
this.reloaded = false
vk.callFunction({
url: 'client/old/pub/getDetail',
title: '请求中...',
data: {
id: this.id
},
success: (res) => {
this.sheet = res
this.reloaded = true
}
}).catch(err => {
if (err.code === -1) {
setTimeout(() => {
vk.navigateBack()
}, 1500)
}
})
},
formatNumber(e) {
this.form1.data.totalPrice = parseFloat(this.form1.data.totalPrice).toFixed(2)
},
onFormSuccess() {
vk.redirectTo({url: `/pages/index/old/detail?id=${this.id}`})
},
// 提交报价单
async submit() {
const data = await vk.userCenter.getCurrentUserInfo();
const {userInfo} = data
if (userInfo.quoteTimes > 3) {
}
// this.$confirm(`今日报价次数${userInfo.quoteTimes || 0}, 是否继续?`, '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// center: true
// }).then(res => {
vk.callFunction({
url: 'client/enquiry/quote/kh/addQuote',
title: '请求中...',
// data: {
// sheet: this.sheet,
// totalPrice: this.totalPrice
// },
success: (data) => {
this.$message({
message: "报价成功",
type: 'success'
})
}
});
// })
},
},
onShow() {
this.reloaded = false
setTimeout(() => {
this.reloaded = true
}, 500)
}
}
</script>
<style lang="scss" scoped>
.page-main {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 20px;
}
.description {
margin-bottom: 40px;
width: 800px;
}
.quote {
display: flex;
align-items: center;
justify-content: space-between;
}
.quote-form {
width: 260px;
}
.form-footer {
height: 40px;
line-height: 40px;
background: #fff;
padding-top: 0;
text-align: center;
display: block;
}
</style>
+195
View File
@@ -0,0 +1,195 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<!-- <view class="page-nav">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item><navigator url="/pages/spot/goods/goods">现货市场</navigator></el-breadcrumb-item>
</el-breadcrumb>
</view> -->
<view class="carousel">
<el-carousel height="170px">
<el-carousel-item v-for="item in 4" :key="item">
<image class="carousel-img"
src="/static/images/600fc93e6b85324b3ea1373ee264290d.jpg"
mode="aspectFill"></image>
</el-carousel-item>
</el-carousel>
<view class="goods-options">
<el-row class="">
<el-button @click="toRelease" type="primary" round>发布旧货交易</el-button>
<!-- <el-button type="primary" round plain>我发布的询价单</el-button> -->
</el-row>
</view>
</view>
<!-- 商品列表 -->
<view class="sheet-list">
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns"
:customRightBtns="table1.customRightBtns"
:pagination="true"></vk-data-table>
</view>
<common-footer></common-footer>
</view>
</template>
<script>
export default {
data() {
return {
keyword: '',
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "client/old/kh/getMyQuoteList",
customRightBtns: [
{
title: '详情',
icon: 'el-icon-search',
type: 'primary',
onClick: (item) => {
vk.navigateTo('/pages/index/old/detail?id=' + item.sheetId);
}
},
],
// 表格字段显示规则
columns: [
{
key: "sheet.title",
title: "旧货标题",
type: "text",
},
{
key: "sheet.type",
title: "旧货类型",
type: "select",
data: [
{value: 0, label: '拍卖'},
{value: 1, label: '采购'},
{value: 2, label: '租赁'},
{value: 3, label: '物资回收'},
]
},
{
key: "totalPrice",
title: "金额",
type: "text",
formatter: (val, row, column, index) => {
return `${val}元`
}
},
{
key: "status",
title: "状态",
type: "select",
data: [
{value: 0, label: '待选商'},
{value: 1, label: '已被选商'},
]
},
{
key: "remark",
title: "备注",
type: "text",
},
{
key: "_add_time_str",
title: "发布时间",
type: "time",
width: 160
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
},
// 表格相关结束 -----------------------------------------------------------
};
},
onLoad() {
},
methods: {
toRelease() {
if (!vk.getVuex('$user.userInfo.fadadaConfirm')) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
} else if (vk.pubfn.isNull(vk.getVuex('$user.userInfo.businessCard'))) {
this.$confirm('您尚未认证和完善名片,是否前往个人中心?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
vk.navigateTo('/pages/user/user?menu=fadada');
})
} else {
uni.navigateTo({
url: '/pages/index/old/release'
})
}
},
}
}
</script>
<style lang="scss" scoped>
.carousel {
width: 1200px;
margin: 20px auto;
}
.carousel-img {
width: 100%;
height: 100%;
}
.goods-options {
background-color: #FFFFFF;
padding: 20px;
}
.filter-outer {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 20px;
}
.tags {
display: flex;
.el-tag {
margin-right: 10px;
}
}
.sheet-list {
width: 1200px;
margin: 20px auto;
// display: flex;
}
.paginatio {
float: none;
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
}
</style>
+136 -33
View File
@@ -1,30 +1,37 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a bg-white">
<image src="/static/images/old/liucheng2.png" class="w-full" mode="widthFix"/>
<view class="p-20">
<el-tabs v-model="activeName" stretch>
<el-tab-pane label="拍卖信息发布" name="0">
<type_0/>
</el-tab-pane>
<el-tab-pane label="采购信息发布" name="1">
<type_1/>
</el-tab-pane>
<el-tab-pane label="承租信息发布" name="2">
<type_2/>
</el-tab-pane>
<el-tab-pane label="物资回收信息发布" name="3">
<type_3/>
</el-tab-pane>
</el-tabs>
</view>
</view>
<gap height="50"/>
<common-footer></common-footer>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a bg-white">
<image src="/static/images/old/liucheng2.png" class="w-full" mode="widthFix"/>
<view class="p-20">
<el-tabs v-model="activeName" stretch>
<el-tab-pane label="拍卖信息发布" name="0">
<type_0 v-if="parseInt(activeName) === 0" :urgentAmount="urgentAmount" :remainOldNum="remainOldNum" :unitList="unitList"
:buyOldNumAmount="buyOldNumAmount" :agreement="agreement"
:commonContractUrl="commonContractUrl" :contactList="contactList"/>
</el-tab-pane>
<el-tab-pane label="采购信息发布" name="1">
<type_1 v-if="parseInt(activeName) === 1" :urgentAmount="urgentAmount" :remainOldNum="remainOldNum"
:buyOldNumAmount="buyOldNumAmount" :agreement="agreement"
:commonContractUrl="commonContractUrl" :contactList="contactList"/>
</el-tab-pane>
<el-tab-pane label="承租、租赁信息发布" name="2">
<type_2 v-if="parseInt(activeName) === 2" :urgentAmount="urgentAmount" :remainOldNum="remainOldNum"
:buyOldNumAmount="buyOldNumAmount" :agreement="agreement"
:commonContractUrl="commonContractUrl" :contactList="contactList"/>
</el-tab-pane>
<el-tab-pane label="物资回收信息发布" name="3">
<type_3 v-if="parseInt(activeName) === 3" :urgentAmount="urgentAmount" :remainOldNum="remainOldNum"
:buyOldNumAmount="buyOldNumAmount" :agreement="agreement" :contactList="contactList"/>
</el-tab-pane>
</el-tabs>
</view>
</view>
<gap height="50"/>
<common-footer></common-footer>
</view>
</template>
<script>
@@ -34,13 +41,109 @@ import Type_2 from "./release/type_2.vue";
import Type_3 from "./release/type_3.vue";
export default {
name: "list",
components: {Type_3, Type_2, Type_1, Type_0},
data() {
return {
activeName: '0'
}
name: "list",
components: {Type_3, Type_2, Type_1, Type_0},
data() {
return {
activeName: '0',
urgentAmount: 1,
remainOldNum: vk.getVuex('$user.userInfo.remainOldNum') ? parseInt(vk.getVuex('$user.userInfo.remainOldNum')) : 0,
buyOldNumAmount: 5,
agreement: '',
commonContractUrl: '',
contactList: [],
unitList: [],
}
},
methods: {
async getUrgentAmount() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6587dd2fe0ec19027452c5b5'
},
})
this.urgentAmount = res.content
},
methods: {}
async getBuyOldAmount() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6587dd54189f86d49b3d5ff5'
},
})
this.buyOldNumAmount = res.content
},
async getUnitList() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: 'a45325976635f10600341a7f2f472cd1'
},
})
this.unitList = res.content.split(',')
},
async getAgreement() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '65885d5b862066f18a4e4a36'
},
})
this.agreement = res.content
},
async getCommonContractUrl() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '657d36befe975f63af1f24e7'
},
})
this.commonContractUrl = res.content
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
},
},
onLoad() {
this.getUnitList()
this.getUrgentAmount()
this.getBuyOldAmount()
this.getAgreement()
this.getCommonContractUrl()
this.getContactList()
},
onShow() {
vk.userCenter.getCurrentUserInfo({
success: (data) => {
this.remainOldNum = data.userInfo.remainOldNum ? parseInt(data.userInfo.remainOldNum) : 0
if (this.remainOldNum === 0) {
this.$confirm('您的旧货发布次数已用完,是否立即购买?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const {data} = await vk.callFunction({
url: 'client/old/kh/buyNum',
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
}).catch(() => {
vk.navigateBack()
})
}
}
});
}
}
</script>
</script>
<style>
/deep/ .el-tabs__item.is-active{
font-size: 1.2rem!important;
}
</style>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+371 -197
View File
@@ -1,135 +1,158 @@
<template>
<view class="flex flex-col justify-start items-start">
<text class="text-50">发布我的回收信息</text>
<text class="text-gray">回收信息越完整,成功交易越容易</text>
<el-form ref="form" :model="form" label-width="140px" class="mt-20">
<el-form-item label="信息失效时间:">
<el-date-picker
v-model="form.expiredTime"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="物资分类:">
<el-radio-group v-model="form.category" size="small">
<el-radio label="机械设备">
<text>机械设备</text>
</el-radio>
<el-radio label="成品钢材">
<text>成品钢材</text>
</el-radio>
<el-radio label="废旧钢材">
<text>废旧钢材</text>
</el-radio>
<el-radio label="旧架子管">
<text>旧架子管</text>
</el-radio>
<el-radio label="旧扣件">
<text>旧扣件</text>
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="信息标题:">
<el-input v-model="form.title" placeholder="一句话简介物资,如拍卖直缝钢管200吨等"/>
</el-form-item>
<el-form-item label="回收方简述:">
<el-input v-model="form.desc" placeholder="请详细描述物资信息,描述内容:材料名称、材质......(限300字以内)"
type="textarea" show-word-limit maxlength="300"/>
</el-form-item>
<el-form-item label="回收物实景照片:">
<vk-data-upload v-model="form.files"
accept="image/*">
</vk-data-upload>
</el-form-item>
<el-form-item label="回收单位地址" class="ml-10">
<el-row :gutter="10">
<el-col :span="5">
<el-select v-model="provinceIndex" placeholder="省" @change="selectProvince">
<el-option v-for="(item, index) in provinceData" :key="index" :value="index"
:label="item.name"/>
</el-select>
</el-col>
<el-col :span="5">
<el-select v-model="cityIndex" placeholder="市" @change="selectCity">
<template v-if="provinceIndex !== null">
<el-option v-for="(item, index) in cityData[provinceIndex]" :key="index"
:value="index"
:label="item.name"/>
</template>
</el-select>
</el-col>
<el-col :span="5">
<el-select v-model="areaIndex" placeholder="区/县" @change="selectArea">
<template v-if="provinceIndex !== null && cityIndex !== null">
<el-option v-for="(item, index) in areaData[provinceIndex][cityIndex]"
:key="index" :value="index"
:label="item.name"/>
</template>
</el-select>
</el-col>
<el-col :span="8">
<el-input v-model="form.addressDetail"
placeholder="详细地址或几公里范围内"></el-input>
</el-col>
</el-row>
</el-form-item>
<view class="form-title-wrap">
<view class="goods-info-title">
<view class="form-title">
回收单位信息
</view>
</view>
</view>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="公司信息">
<el-input v-model="form.supplier.companyName"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公司联系方式">
<el-input v-model="form.supplier.contract"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="个人信息">
<el-input v-model="form.supplier.personalName"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="个人联系方式">
<el-input v-model="form.supplier.personalContract"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12">
<el-form-item label="授权人姓名">
<el-input v-model="form.supplier.managerName"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="授权联系方式">
<el-input v-model="form.supplier.managerContract"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<view class="mt-20 flex justify-start items-center">
<text class="mr-25">您是否对以上信息进行了详细核实:</text>
<el-radio label="是" v-model="checked">
<text>是</text>
</el-radio>
<el-radio label="否" v-model="checked">
<text>否</text>
</el-radio>
</view>
<view class="flex justify-center items-center mt-30 m-a">
<el-button type="primary" :disabled="checked === '否'" @click="publish">立即发布</el-button>
<view class="flex flex-col justify-start items-start">
<text class="text-50">发布我的回收信息</text>
<text class="text-gray">回收信息越完整,成功交易越容易</text>
<el-form ref="form" :model="form" label-width="140px" class="mt-20">
<el-form-item label="信息失效时间:" required>
<el-date-picker
:picker-options="pickerOptions"
v-model="form.expiredTime"
type="datetime"
placeholder="选择日期时间">
</el-date-picker>
</el-form-item>
<el-form-item label="物资分类:" required>
<div class="flex justify-start items-center">
<el-cascader :options="cateData" v-model="form.category" :disabled="form.otherCate"
:props="{'label': 'name', 'value': 'name'}"/>
<el-checkbox v-model="form.otherCate" class="mx-20">其他分类</el-checkbox>
<el-input v-model="form.otherCateName" :disabled="!form.otherCate" placeholder="如物资分类选项中不能描述您的信息物资主要内容,请在此用专业或通用术语填写"
class="ml-20"/>
</div>
</el-form-item>
<el-form-item label="信息标题:" required>
<el-input v-model="form.title" placeholder="一句话简介回收内容,如 常年回收 二手、废旧螺纹钢、型材等"/>
</el-form-item>
<el-form-item label="回收方简述:">
<el-input v-model="form.desc" placeholder="请详细描述物资信息,描述内容:材料名称、材质......(限300字以内)"
type="textarea" show-word-limit maxlength="300"/>
</el-form-item>
<el-form-item label="回收物实景照片:">
<vk-data-upload v-model="form.files" list-type="text"
accept="image/*">
</vk-data-upload>
</el-form-item>
<el-form-item label="回收单位地址" class="ml-10" required>
<el-row :gutter="10">
<el-col :span="5">
<el-select v-model="provinceIndex" placeholder="省" @change="selectProvince">
<el-option v-for="(item, index) in provinceData" :key="index" :value="index"
:label="item.name"/>
</el-select>
</el-col>
<el-col :span="5">
<el-select v-model="cityIndex" placeholder="市" @change="selectCity">
<template v-if="provinceIndex !== null">
<el-option v-for="(item, index) in cityData[provinceIndex]" :key="index"
:value="index"
:label="item.name"/>
</template>
</el-select>
</el-col>
<el-col :span="5">
<el-select v-model="areaIndex" placeholder="区/县" @change="selectArea">
<template v-if="provinceIndex !== null && cityIndex !== null">
<el-option v-for="(item, index) in areaData[provinceIndex][cityIndex]"
:key="index" :value="index"
:label="item.name"/>
</template>
</el-select>
</el-col>
<el-col :span="8">
<el-input v-model="form.addressDetail"
placeholder="详细地址或几公里范围内"></el-input>
</el-col>
</el-row>
</el-form-item>
<view class="form-title-wrap">
<view class="goods-info-title">
<view class="form-title">
回收单位信息
</view>
</view>
</view>
<el-row :gutter="10" v-if="vk.getVuex('$user.userInfo.accountType') === 2">
<el-col :span="12">
<el-form-item label="公司信息">
<el-input v-model="form.supplier.companyName"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="公司联系方式">
<el-input v-model="form.supplier.contract"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10" v-if="vk.getVuex('$user.userInfo.accountType') === 1">
<el-col :span="12">
<el-form-item label="个人信息">
<el-input v-model="form.supplier.personalName"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="个人联系方式">
<el-input v-model="form.supplier.personalContract"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="12" class="flex justify-start items-center">
<el-form-item label="授权业务咨询人">
<el-select v-model="form.supplier.managerName" placeholder="点击选择业务联系人"
class="w-100p" @change="selectContact">
<el-option
v-for="(item, index) in contactList"
:key="index"
:label="item.name"
:value="item.name">
</el-option>
<view slot="empty" class="text-gray pointer p-20">
<text>无业务联系人,请到</text>
<text class="text-main mx-15" @click="navTo">个人中心</text>
<text>添加</text>
</view>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12" class="flex justify-start items-center">
<el-form-item label="业务咨询联系方式">
<el-input v-model="form.supplier.managerContract" type="number" disabled/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<view class="mt-20 flex justify-start items-center">
<text class="mr-25">您是否对以上信息进行了详细核实:</text>
<el-radio label="是" v-model="checked">
<text>是</text>
</el-radio>
<el-radio label="否" v-model="checked">
<text>否</text>
</el-radio>
</view>
<view class="mt-20 flex justify-start items-center">
<text class="mr-25">是否加急({{ urgentAmount }}元/次,将在旧货交易页面加急展示区展示):</text>
<el-radio :label="true" v-model="form.isUrgent">
<text>是</text>
</el-radio>
<el-radio :label="false" v-model="form.isUrgent">
<text>否</text>
</el-radio>
</view>
<view class="my-25 text-main font-bold">本月剩余旧货发布次数:{{ remainOldNum }}</view>
<view class="flex justify-start items-center">
<el-checkbox v-model="agree">我已阅读并同意</el-checkbox>
<span class="text-main pointer font-bold" @click="showAgreement">《金久信旧货交易协议》</span>
</view>
<view class="flex justify-center items-center mt-30 m-a">
<el-button type="primary" :disabled="checked === '否' || !agree" @click="publish">立即发布</el-button>
</view>
<el-dialog title="金久信旧货交易协议" :visible.sync="dialogVisible" width="70%" close-on-press-escape
close-on-click-modal show-close
>
<div v-html="agreement"></div>
</el-dialog>
</view>
</template>
<script>
@@ -138,59 +161,206 @@ import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
export default {
name: "type_3",
data() {
return {
provinceData: provinces,
cityData: citys,
areaData: areas,
form: {
type: 3,
category: 0,
files: [],
title: '',
desc: '',
addressRegion: [],
addressDetail: '',
expiredTime: '',
supplier: {
companyName: '',
contract: '',
personalName: '',
personalContract: '',
managerName: '',
managerContract: '',
},
},
provinceIndex: null,
cityIndex: null,
areaIndex: null,
checked: '否'
}
name: "type_3",
props: {
urgentAmount: {
type: Number,
default: 10
},
methods: {
selectProvince(index) {
this.form.addressRegion[0] = this.provinceData[index]
remainOldNum: {
type: Number,
default: 0
},
agreement: {
type: String,
default: ''
},
contactList: {
type: Array,
default: ''
},
},
data() {
return {
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now();
},
selectCity(index) {
this.form.addressRegion[1] = this.cityData[this.provinceIndex][index]
},
agree: false,
provinceData: provinces,
cityData: citys,
areaData: areas,
allChildCate: [],
cateData: [],
form: {
otherCate: false,
otherCateName: '',
type: 3,
category: 0,
files: [],
title: '',
desc: '',
addressRegion: {},
addressDetail: '',
expiredTime: '',
supplier: {
companyName: '',
contract: '',
personalName: '',
personalContract: '',
managerName: '',
managerContract: '',
},
selectArea(index) {
this.form.addressRegion[2] = this.areaData[this.provinceIndex][this.cityIndex][index]
},
async publish() {
await vk.callFunction({
url: 'client/old/kh/add',
data: this.form
})
this.$message({
message: "提交成功",
type: 'success'
})
vk.navigateBack()
}
isUrgent: false
},
provinceIndex: null,
cityIndex: null,
areaIndex: null,
checked: '否',
dialogVisible: false
}
},
methods: {
selectProvince(index) {
this.form.addressRegion.province = this.provinceData[index]
},
selectCity(index) {
this.form.addressRegion.city = this.cityData[this.provinceIndex][index]
},
selectArea(index) {
this.form.addressRegion.area = this.areaData[this.provinceIndex][this.cityIndex][index]
},
async publish() {
if (this.remainOldNum === 0) {
this.$confirm('您的旧货发布次数已用完,是否立即购买?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async ({confirm}) => {
if (confirm) {
const {data} = await vk.callFunction({
url: 'client/old/kh/buyNum',
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
}
})
return
}
if (this.provinceIndex === null || this.cityIndex === null || this.areaIndex === null) return this.$message({
message: "请选择完整的地址",
type: 'warning'
})
if (!this.form.addressDetail) return this.$message({
message: "请填写详细地址",
type: 'warning'
})
if (!this.form.title) return this.$message({
message: "请填写标题",
type: 'warning'
})
if (!this.form.otherCate) {
if (!this.form.category) return this.$message({
message: "请选择分类",
type: 'warning'
})
} else {
if (!this.form.otherCateName) return this.$message({
message: "请输入其他分类",
type: 'warning'
})
this.form.category = ['', this.form.otherCateName]
}
if (!this.form.expiredTime) return this.$message({
message: "请选择失效时间",
type: 'warning'
})
const res = await vk.callFunction({
url: 'client/old/kh/add',
data: this.form
})
localStorage.removeItem("old_3")
this.$message({
message: "您的信息已经提交,等待管理员审核,请您耐心等待!",
type: 'success'
})
if (this.form.isUrgent) {
vk.navigateTo({
url: `/pages/index/shop/pay?id=${res.data}`
})
} else {
vk.redirectTo({url: '/pages/index/old/old'});
}
},
showAgreement() {
// this.$confirm(this.agreement, '金久信旧货交易协议', {
// cancelButtonText: '关闭',
// showConfirmButton: false,
// dangerouslyUseHTMLString: true,
// customClass: 'confirm-box'
// })
this.dialogVisible = true
},
navTo() {
vk.navigateTo({url: '/pages/user/user?menu=business-contact'})
},
selectContact(name) {
const contact = this.contactList.find(item => item.name === name)
this.form.supplier.managerContract = contact.phone
},
save() {
localStorage.setItem("old_3", JSON.stringify({
form: this.form,
provinceIndex: this.provinceIndex,
cityIndex: this.cityIndex,
areaIndex: this.areaIndex,
}))
this.$message({
message: "已保存",
type: 'success'
})
}
},
mounted() {
vk.callFunction({
url: 'client/old/pub/getTree',
title: '请求中...',
data: {type: 3},
success: (data) => {
this.cateData = data.rows.map(item => {
item.children.forEach(child => {
delete child.children
})
return item
})
}
});
if (vk.getVuex('$user.userInfo.accountType') === 2) {
this.form.supplier.companyName = vk.getVuex('$user.userInfo.company.companyName')
this.form.supplier.contract = vk.getVuex('$user.userInfo.company.mobile')
} else {
this.form.supplier.personalName = vk.getVuex('$user.userInfo.person.personName')
this.form.supplier.personalContract = vk.getVuex('$user.userInfo.person.mobile')
}
if (!!localStorage.getItem("old_3")) {
this.$confirm('您有一份暂存数据,是否恢复?', '提示', {
confirmButtonText: '确定',
type: 'warning'
}).then(() => {
const savedData = JSON.parse(localStorage.getItem("old_3"))
this.form = savedData.form
this.provinceIndex = savedData.provinceIndex
this.cityIndex = savedData.cityIndex
this.areaIndex = savedData.areaIndex
})
}
}
}
</script>
@@ -198,38 +368,42 @@ export default {
@import "@/common/css/app.scss";
.form-title-wrap {
display: flex;
align-items: center;
justify-content: space-between;
.goods-info-title {
display: flex;
align-items: center;
justify-content: space-between;
justify-content: flex-start;
}
.goods-info-title {
display: flex;
align-items: center;
justify-content: flex-start;
}
.form-title {
padding-left: 10px;
color: $--color-primary;
font-size: 18px;
line-height: 18px;
border-left: 4px solid $--color-primary;
}
.form-title {
padding-left: 10px;
color: $--color-primary;
font-size: 18px;
line-height: 18px;
border-left: 4px solid $--color-primary;
}
}
.sign-method-header {
width: 120px;
width: 120px;
}
</style>
<style>
/deep/ .input-with-select{
width: 200px;
/deep/ .input-with-select {
width: 200px;
}
/deep/ .input-with-select .el-input-group__append {
background-color: #fff !important;
width: 80px !important;
background-color: #fff !important;
width: 80px !important;
}
.confirm-box .el-dialog {
width: 70%;
}
</style>
+560 -342
View File
@@ -1,191 +1,247 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<u-swiper :list="list" :height="380" borderRadius="0"></u-swiper>
<view class="bg-white p-40">
<view v-for="(item, index) in configList" :key="index"
class="my-20 flex flex-col justify-start items-start">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center text-35 mb-20">
<text>服务内容:{{ item.name }}</text>
<view class="flex flex-col justify-start items-start">
<view v-for="(content, contentIndex) in item.contents" :key="contentIndex"
class="mb-40 flex justify-start items-center">
<view class="ml-35">
<text>业务编号:</text>
<text>{{ content.code }}</text>
</view>
<view class="flex justify-start items-center">
<text class="ml-35">服务服务项目:</text>
<el-checkbox v-model="configList[index].contents[contentIndex].checked"
:disabled="!content.amountList || content.amountList.length === 0">
{{ content.title }}
</el-checkbox>
</view>
<view class="flex justify-start items-center ml-35">
<el-select v-model="configList[index].contents[contentIndex].amountIndex"
clearable @change="selectAmount(index, contentIndex, $event)"
:disabled="!content.amountList || content.amountList.length === 0">
<el-option v-for="(amount, amountIndex) in content.amountList"
:key="amountIndex"
:label="amount.title" :value="amountIndex"/>
</el-select>
<text class="ml-35" v-if="content.amountIndex !== null">
{{ content.amountList[content.amountIndex].amount }}元/次
</text>
</view>
</view>
</view>
</view>
<view>备注: {{ item.remark }}</view>
</view>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<common-swiper page="self-support-company-swiper"/>
<view class="flex justify-end items-center text-main pointer my-20 " @click="demoDownload">示例下载</view>
<view class="bg-white p-40">
<view v-for="(item, index) in configList" :key="index"
class="server-item my-20 flex flex-col justify-start items-start">
<el-checkbox @change="changeCheck(index, item.name)">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center text-35 mb-20">
<view class="name">{{ item.name }}</view>
<view class="ml-15">
<text>业务编号:</text>
<text v-if="item.contentIndex !== null">{{
item.contents[item.contentIndex].code
}}
</text>
</view>
<el-form ref="form" :model="form" label-width="200px">
<view v-for="(item, companyIndex) in companyList" :key="companyIndex">
<el-form-item label="考察对象(个人/企业全称):" required>
<el-input v-model="companyList[companyIndex].name"/>
</el-form-item>
<el-form-item label="考察对象(个人身份证/企业信用代码):">
<el-input v-model="companyList[companyIndex].code"/>
</el-form-item>
<el-form-item label="考察对象(个人/单位)所在地:">
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][1]" placeholder="请选择市"
:disabled="addressIndex[companyIndex].length === 0">
<template v-if="addressIndex[companyIndex][0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[companyIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][2]" placeholder="请选择区"
:disabled="addressIndex[companyIndex].length === 1">
<template
v-if="addressIndex[companyIndex][0] !== null && addressIndex[companyIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[addressIndex[companyIndex][0]][addressIndex[companyIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="companyList[companyIndex].address" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="接收文件电子邮箱:">
<el-input v-model="companyList[companyIndex].email"/>
</el-form-item>
<el-form-item label="接收文件微信:">
<el-input v-model="companyList[companyIndex].wechat"/>
</el-form-item>
<el-form-item label="接收文件寄件地址">
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="receiveAddressIndex[companyIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[companyIndex][1]" placeholder="请选择市"
:disabled="receiveAddressIndex[companyIndex].length === 0">
<template v-if="receiveAddressIndex[companyIndex][0] !== null">
<el-option
v-for="(item, index) in cityData[receiveAddressIndex[companyIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[companyIndex][2]" placeholder="请选择区"
:disabled="receiveAddressIndex[companyIndex].length === 1">
<template
v-if="receiveAddressIndex[companyIndex][0] !== null && receiveAddressIndex[companyIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[receiveAddressIndex[companyIndex][0]][receiveAddressIndex[companyIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="companyList[companyIndex].receiveAddress" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="申请人:">
<el-input v-model="companyList[companyIndex].requestName"/>
</el-form-item>
<el-form-item label="联系人:">
<el-input v-model="companyList[companyIndex].contactName"/>
</el-form-item>
<el-form-item label="联系方式:">
<el-input v-model="companyList[companyIndex].contact"/>
</el-form-item>
<el-form-item label="本次服务费用小计:">
<view class="flex justify-between items-start mb-20 w-100p">
<view class="flex justify-start items-center">
<el-input v-model="amount" disabled/>
<view class="ml-20">
<el-button type="primary" @click.native="addCompany">增加考察对象
</el-button>
</view>
<view class="ml-20">
<el-button type="primary" plain @click.native="removeCompany(companyIndex)"
class="ml-20"
:disabled="companyList.length === 1">删除该对象
</el-button>
</view>
</view>
</view>
</el-form-item>
</view>
</el-form>
<view class="mt-40 flex justify-center items-center">
<view class="flex justify-center items-center">
<text>总价:</text>
<text class="text-main font-bold text-35">{{ totalAmount }}元</text>
</view>
<view class="ml-35">客服联系方式: 0771-3923001</view>
<view class="server-item-content">
<text class="ml-15">服务项目:</text>
<el-select v-model="configList[index].contentIndex" clearable
:disabled="!contentList.includes(index)">
<el-option v-for="(content, contentIndex) in item.contents" :key="contentIndex"
:label="content.title" :value="contentIndex"/>
</el-select>
<template v-if="item.contentIndex !== null">
<el-select v-model="configList[index].amountIndex"
clearable class="ml-15">
<el-option
v-for="(amount, amountIndex) in item.contents[item.contentIndex].amountList"
:key="amountIndex"
:label="amount.title" :value="amountIndex"/>
</el-select>
</template>
</view>
<view class="mt-40 flex justify-center items-center">
<el-button type="primary" @click="newOrder"
:disabled="companyList.length === 0 || !companyList[0].name">
立即支付
</el-button>
<text>金额:</text>
<view class="ml-15" v-if="item.contentIndex !== null && item.amountIndex!== null">
{{ item.contents[item.contentIndex].amountList[item.amountIndex].amount }}元/次
</view>
<view class="ml-15" v-else>
元/次
</view>
</view>
<view class="remark">备注: {{ item.remark }}</view>
</view>
</el-checkbox>
</view>
<gap/>
<common-footer></common-footer>
<el-form ref="form" :model="form" label-width="200px">
<view v-for="(item, companyIndex) in companyList" :key="companyIndex">
<el-divider>{{ item.name }}</el-divider>
<el-form-item label="考察对象类型:" required>
<el-select v-model="companyList[companyIndex].type" placeholder="请选择考察对象类型">
<el-option label="企业" value="企业"></el-option>
<el-option label="个人" value="个人"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="`考察对象(${item.type}全称):`" required>
<el-input v-model="companyList[companyIndex].name"/>
</el-form-item>
<template v-if="item.type === '个人'">
<el-form-item label="考察对象(个人身份证): " required>
<el-input v-model="companyList[companyIndex].code"/>
</el-form-item>
<el-form-item label="考察对象所在地:" required>
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][1]" placeholder="请选择市"
:disabled="addressIndex[companyIndex].length === 0">
<template v-if="addressIndex[companyIndex][0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[companyIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][2]" placeholder="请选择区"
:disabled="addressIndex[companyIndex].length === 1">
<template
v-if="addressIndex[companyIndex][0] !== null && addressIndex[companyIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[addressIndex[companyIndex][0]][addressIndex[companyIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="companyList[companyIndex].address" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
</template>
<el-form-item label="本次服务费用小计:">
<view class="flex justify-between items-start mb-20 w-100p">
<view class="flex justify-start items-center">
<el-input v-model="amount" disabled/>
<view class="ml-20">
<el-button type="primary" plain @click.native="removeCompany(companyIndex)"
class="ml-20"
:disabled="companyList.length === 1">删除该对象
</el-button>
</view>
</view>
</view>
</el-form-item>
</view>
<el-divider/>
<el-button type="primary" @click.native="addCompany">增加考察对象
</el-button>
<el-form-item label="接收文件电子邮箱:" required>
<el-input v-model="email"/>
</el-form-item>
<el-form-item label="接收文件微信:" required>
<el-input v-model="wechat"/>
</el-form-item>
<el-form-item label="接收文件寄件地址" required>
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="receiveAddressIndex[0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[1]" placeholder="请选择市"
:disabled="receiveAddressIndex.length === 0">
<template v-if="receiveAddressIndex[0] !== null">
<el-option
v-for="(item, index) in cityData[receiveAddressIndex[0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[2]" placeholder="请选择区"
:disabled="receiveAddressIndex.length === 1">
<template
v-if="receiveAddressIndex[0] !== null && receiveAddressIndex[1] !== null">
<el-option
v-for="(item, index) in areaData[receiveAddressIndex[0]][receiveAddressIndex[1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="receiveAddress"
placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<p class="text-main text-25 text-center" style="margin-bottom: 80rpx">接收文件电子邮箱/ 接收文件微信/
接收文件寄件地址,以上三项选填一项即可</p>
<el-row :gutter="10">
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="申请人:" required>
<el-input v-model="requestName"/>
</el-form-item>
</el-col>
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="业务联系人:" required>
<el-input v-model="contactName"/>
</el-form-item>
</el-col>
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="业务咨询联系方式:" required>
<el-input v-model="contact"/>
</el-form-item>
</el-col>
<!-- <el-col :span="8" class="flex justify-start items-center">-->
<!-- <el-form-item label="业务联系人:" required>-->
<!-- <el-select v-model="contactName" placeholder="点击选择业务联系人"-->
<!-- class="w-100p" @change="selectContact">-->
<!-- <el-option-->
<!-- v-for="(item, index) in contactList"-->
<!-- :key="index"-->
<!-- :label="item.name"-->
<!-- :value="item.name">-->
<!-- </el-option>-->
<!-- <view slot="empty" class="text-gray pointer p-20">-->
<!-- <text>无业务联系人,请到</text>-->
<!-- <text class="text-main mx-15" @click="navTo">个人中心</text>-->
<!-- <text>添加</text>-->
<!-- </view>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8" class="flex justify-start items-center">-->
<!-- <el-form-item label="业务咨询联系方式:" required>-->
<!-- <el-input v-model="contact" type="number" disabled/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
<!-- <el-form-item label="联系方式:" required>-->
<!-- <el-input v-model="contact" disabled/>-->
<!-- </el-form-item>-->
</el-form>
<view class="mt-40 flex justify-center items-center">
<view class="flex justify-center items-center">
<text>总价:</text>
<text class="text-main font-bold text-35">{{ totalAmount }}元</text>
</view>
<view class="ml-35">客服联系方式: 0771-3923001</view>
</view>
<view class="flex justify-start items-center">
<el-checkbox v-model="agree">我已阅读并同意</el-checkbox>
<span class="text-main pointer font-bold" @click="showAgreement">《金久信自营交易协议》</span>
</view>
<view class="mt-40 flex justify-center items-center">
<el-button type="primary" @click="newOrder"
:disabled="companyList.length === 0 || !companyList[0].name || !agree">
立即支付
</el-button>
</view>
</view>
</view>
<gap/>
<common-footer></common-footer>
</view>
</template>
<script>
@@ -195,167 +251,329 @@ import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import Gap from "../../../components/gap/gap.vue";
export default {
name: "companyQuote",
components: {Gap},
data() {
return {
provinceData: provinces,
cityData: citys,
areaData: areas,
list: [
{
image: '/static/images/selfSupport/swiper.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
],
form: {},
configList: [],
checkList: [],
contentList: [],
contentNameList: [],
addressIndex: [[null, null, null]],
addressDetail: '',
receiveAddressIndex: [[null, null, null]],
receiveAddressDetail: '',
companyList: [
{
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
}
],
}
},
methods: {
async getConfigList() {
const {rows} = await vk.callFunction({
url: 'client/coop/config/pub/getList',
data: {type: 0}
})
if (rows) {
this.configList = rows.map(item => {
item.contents.map(content => {
content.checked = false
content.amountIndex = null
return content
})
return item
})
}
},
addCompany() {
this.companyList.push({
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
})
this.addressIndex.push([null, null, null])
this.receiveAddressIndex.push([null, null, null])
},
removeCompany(index) {
this.companyList.splice(index, 1)
this.addressIndex.splice(index, 1)
this.receiveAddressIndex.splice(index, 1)
},
async newOrder() {
const amountList = []
this.configList.forEach(item => {
item.contents.forEach(content => {
if (content.checked && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === content.amountIndex) {
amountList.push(amount._index)
}
})
}
})
})
if (amountList.length === 0) return this.$message({
message: '请至少选择一项服务',
type: 'error'
})
this.companyList.forEach((item, index) => {
this.companyList[index].addressRegion = {
province: this.provinceData[this.addressIndex[index][0]],
city: this.cityData[this.addressIndex[index][0]][this.addressIndex[index][1]],
area: this.areaData[this.addressIndex[index][0]][this.addressIndex[index][1]][this.addressIndex[index][2]],
}
this.companyList[index].receiveAddressRegion = {
province: this.provinceData[this.receiveAddressIndex[index][0]],
city: this.cityData[this.receiveAddressIndex[index][0]][this.receiveAddressIndex[index][1]],
area: this.areaData[this.receiveAddressIndex[index][0]][this.receiveAddressIndex[index][1]][this.receiveAddressIndex[index][2]],
}
})
const {data} = await vk.callFunction({
url: 'client/selfSupport/kh/addOrder',
data: {
type: 0,
amountList,
contentList: this.companyList
}
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
},
selectAmount(index, contentIndex, e) {
console.log(index, contentIndex, e)
}
},
onLoad() {
this.getConfigList()
},
computed: {
amount() {
let tmpAmount = 0
this.configList.forEach(item => {
item.contents.forEach(content => {
if (content.checked && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === content.amountIndex) {
tmpAmount += parseFloat(amount.amount)
}
})
}
})
})
return tmpAmount
},
totalAmount() {
return this.amount * this.companyList.length
name: "companyQuote",
components: {Gap},
data() {
return {
provinceData: provinces,
cityData: citys,
areaData: areas,
form: {},
configList: [],
checkList: [],
contentList: [],
contentNameList: [],
addressIndex: [[null, null, null]],
addressDetail: '',
receiveAddressIndex: [null, null, null],
receiveAddressDetail: '',
companyList: [
{
name: '',
code: '',
type: '企业',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
}
],
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
agreement: '',
agree: false,
contactList: []
}
},
methods: {
async getConfigList() {
const {rows} = await vk.callFunction({
url: 'client/coop/config/pub/getList',
data: {type: 0}
})
if (rows) {
this.configList = rows.map(item => {
item.contentIndex = null
item.amountIndex = null
return item
})
}
},
changeCheck(itemIndex, name) {
const index = this.contentList.indexOf(itemIndex)
if (index === -1) {
this.contentList.push(itemIndex)
this.contentNameList.push(name)
} else {
this.contentList.splice(index, 1)
this.contentNameList.splice(index, 1)
this.configList[itemIndex].contentIndex = null
this.configList[itemIndex].amountIndex = null
}
},
addCompany() {
this.companyList.push({
name: '',
code: '',
type: '企业',
addressRegion: {
province: null,
city: null,
area: null,
},
})
this.addressIndex.push([null, null, null])
this.receiveAddressIndex.push([null, null, null])
},
removeCompany(index) {
this.companyList.splice(index, 1)
this.addressIndex.splice(index, 1)
this.receiveAddressIndex.splice(index, 1)
},
async newOrder() {
const amountList = []
this.configList.forEach(item => {
item.contents.forEach((content, contentIndex) => {
if (contentIndex === item.contentIndex && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === item.amountIndex) {
amountList.push(`${content._index},${amount._index}`)
}
})
}
})
})
if (amountList.length === 0) return this.$message({
message: '请至少选择一项服务',
type: 'error'
})
// if (this.addressIndex[0][2] === null) return this.$message({
// message: '请选择地址',
// type: 'error'
// })
if (!this.email && !this.wechat && this.receiveAddressIndex[0][2] === null) return this.$message({
message: '请选择接收文件地址/微信/邮箱',
type: 'error'
})
this.companyList.forEach((item, index) => {
if (this.addressIndex[index][2]) {
const companyProvince = this.provinceData[this.addressIndex[index][0]]
const companyCity = this.cityData[this.addressIndex[index][0]][this.addressIndex[index][1]]
const companyArea = this.areaData[this.addressIndex[index][0]][this.addressIndex[index][1]][this.addressIndex[index][2]]
this.companyList[index].addressRegion = {
province: {code: companyProvince.code, name: companyProvince.name},
city: {code: companyCity.code, name: companyCity.name},
area: {code: companyArea.code, name: companyArea.name},
}
}
})
for (let i = 0; i < this.companyList.length; i++) {
if (!this.companyList[i].name) return this.$message({
message: '请填写考察对象名称',
type: 'error'
})
if (this.companyList[i].type === '个人') {
if (!this.companyList[i].code) return this.$message({
type: 'error',
message: '请填写考察个人身份证号',
})
if (!this.companyList[i].address) return this.$message({
type: 'error',
message: '请填写个人地址',
})
if (this.addressIndex[i][2] === null) return this.$message({
type: 'error',
message: '请填写个人地址',
})
}
}
if (!this.requestName) return this.$message({
type: 'error',
message: '请填写申请人',
})
if (!this.contactName) return this.$message({
type: 'error',
message: '请填写业务联系人姓名',
})
if (!this.contact) return this.$message({
type: 'error',
message: '请填写联系人电话',
})
if (this.receiveAddressIndex.length > 0 && this.receiveAddressIndex[2] !== null) {
const province = this.provinceData[this.receiveAddressIndex[0]]
const city = this.cityData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]]
const area = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]][this.receiveAddressIndex[2]]
this.receiveAddressRegion = {
province: {code: province.code, name: province.name},
city: {code: city.code, name: city.name},
area: {code: area.code, name: area.name},
}
}
const {data} = await vk.callFunction({
url: 'client/selfSupport/kh/addOrder',
title: '提交中...',
data: {
type: 0,
amountList,
contentList: this.companyList,
receiveAddressRegion: this.receiveAddressRegion,
email: this.email,
wechat: this.wechat,
receiveAddress: this.receiveAddress,
requestName: this.requestName,
contactName: this.contactName,
contact: this.contact,
}
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
},
showAgreement() {
this.$confirm(this.agreement, '金久信自营交易协议', {
cancelButtonText: '关闭',
showConfirmButton: false,
dangerouslyUseHTMLString: true,
})
},
async getAgreement() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '65885d4c09664c1c8d8e8476'
},
})
this.agreement = res.content
},
demoDownload() {
vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6588642a99c624e89199fbb4'
},
success: res => {
window.open(res.content)
}
})
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
},
navTo() {
vk.navigateTo({url: '/pages/user/user?menu=business-contact'})
},
selectContact(name) {
const contact = this.contactList.find(item => item.name === name)
this.contact = contact.phone
}
},
onLoad() {
const userInfo = vk.getVuex('$user.userInfo')
if (parseInt(userInfo.accountType) === 2) {
this.email = userInfo.company.contactEmail
this.requestName = userInfo.manager.personName
this.contactName = userInfo.manager.personName
this.contact = userInfo.company.mobile
if (userInfo.company && userInfo.company.addressRegion) {
this.receiveAddressIndex[0] = this.provinceData.findIndex(item => item.name === userInfo.company.addressRegion.province.name)
this.receiveAddressIndex[1] = this.cityData[this.receiveAddressIndex[0]].findIndex(item => item.name === userInfo.company.addressRegion.city.name)
this.receiveAddressIndex[2] = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]].findIndex(item => item.name === userInfo.company.addressRegion.area.name)
}
if (userInfo.company.addressDetail) this.receiveAddress = userInfo.company.addressDetail
} else {
if (userInfo.businessCard && userInfo.businessCard.email) this.email = userInfo.businessCard.email
this.requestName = userInfo.person.personName
this.contactName = userInfo.person.personName
this.contact = userInfo.person.mobile
if (userInfo.person && userInfo.person.addressRegion) {
this.receiveAddressIndex[0] = this.provinceData.findIndex(item => item.name === userInfo.person.addressRegion.province.name)
this.receiveAddressIndex[1] = this.cityData[this.receiveAddressIndex[0]].findIndex(item => item.name === userInfo.person.addressRegion.city.name)
this.receiveAddressIndex[2] = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]].findIndex(item => item.name === userInfo.person.addressRegion.area.name)
}
if (userInfo.person.addressDetail) this.receiveAddress = userInfo.person.addressDetail
}
this.getAgreement()
this.getConfigList()
// this.getContactList()
},
computed: {
amount() {
let tmpAmount = 0
this.configList.forEach(item => {
item.contents.forEach((content, contentIndex) => {
if (contentIndex === item.contentIndex && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === item.amountIndex) {
tmpAmount += parseFloat(amount.amount)
}
})
}
})
})
return tmpAmount
},
totalAmount() {
return this.amount * this.companyList.length
}
}
}
</script>
</script>
<style lang="scss" scoped>
.server-item {
background-color: #fbf8f8;
border: 2px solid #fbebf1;
padding: 10px;
display: flex;
justify-content: space-between;
margin-bottom: 20px;
.items-center {
width: 1100px;
display: flex;
justify-content: space-between;
align-items: center;
flex: 1;
view {
width: 300px;
}
.ml-35 {
font-weight: normal;
font-size: 13px;
}
}
.server-item-content {
display: flex;
align-items: center;
width: 600px !important;
}
.remark {
color: #999999;
font-weight: normal;
}
}
.divider-title {
font-size: 17px;
font-weight: bold;
}
</style>
+525
View File
@@ -0,0 +1,525 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<common-swiper page="self-support-quote-swiper"/>
<view class="flex justify-end items-center text-main pointer my-20 " @click="demoDownload">示例下载</view>
<view class="bg-white p-40">
<view v-for="(item, index) in configList" :key="index"
class="server-item my-20 flex flex-col justify-start items-start">
<el-checkbox @change="changeCheck(index, item.name)">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center text-35 mb-20">
<view class="name" style="width: 120px;">{{ item.name }}</view>
<view class="ml-15" style="width: 120px;">
<text>业务编号:</text>
<text v-if="item.contentIndex !== null">{{
item.contents[item.contentIndex].code
}}
</text>
</view>
<view class="server-item-content">
<text class="ml-15">服务项目:</text>
<el-select v-model="configList[index].contentIndex" clearable style="width: 200px"
:disabled="!contentList.includes(index)">
<el-option v-for="(content, contentIndex) in item.contents" :key="contentIndex"
:label="content.title" :value="contentIndex"/>
</el-select>
<template v-if="item.contentIndex !== null">
<el-select v-model="configList[index].amountIndex" @change="changeAmountIndex(index)"
clearable class="ml-15" style="width: 300px">
<el-option
v-for="(amount, amountIndex) in item.contents[item.contentIndex].amountList"
:key="amountIndex"
:label="amount.title" :value="amountIndex"/>
</el-select>
<template v-if="configList[index].amountIndex !== null">
<text class="ml-15">清单单品项数:</text>
<el-input v-model="configList[index].num" style="width: 200px"/>
</template>
</template>
</view>
</view>
<view class="remark">备注: {{ item.remark }}</view>
</view>
</el-checkbox>
</view>
<el-form ref="form" :model="form" label-width="200px">
<view v-for="(item, companyIndex) in companyList" :key="companyIndex">
<el-divider>{{ item.name }}</el-divider>
<el-form-item label="产品明细:" required>
<vk-data-upload v-model="companyList[companyIndex].files" list-type="text"
:on-preview="previewUpload"
accept=".jpg,.jpeg,.png,.xlsx,.doc,.docx,.pdf">
</vk-data-upload>
</el-form-item>
<el-form-item label="产品应用地址:" required>
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][1]" placeholder="请选择市"
:disabled="addressIndex[companyIndex].length === 0">
<template v-if="addressIndex[companyIndex][0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[companyIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[companyIndex][2]" placeholder="请选择区"
:disabled="addressIndex[companyIndex].length === 1">
<template
v-if="addressIndex[companyIndex][0] !== null && addressIndex[companyIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[addressIndex[companyIndex][0]][addressIndex[companyIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="companyList[companyIndex].address" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
</view>
<el-divider/>
<el-form-item label="接收文件电子邮箱:" required>
<el-input v-model="email"/>
</el-form-item>
<el-form-item label="接收文件微信:" required>
<el-input v-model="wechat"/>
</el-form-item>
<el-form-item label="接收文件寄件地址" required>
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="receiveAddressIndex[0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[1]" placeholder="请选择市"
:disabled="receiveAddressIndex.length === 0">
<template v-if="receiveAddressIndex[0] !== null">
<el-option
v-for="(item, index) in cityData[receiveAddressIndex[0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[2]" placeholder="请选择区"
:disabled="receiveAddressIndex.length === 1">
<template
v-if="receiveAddressIndex[0] !== null && receiveAddressIndex[1] !== null">
<el-option
v-for="(item, index) in areaData[receiveAddressIndex[0]][receiveAddressIndex[1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="receiveAddress" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<p class="text-main text-25 text-center" style="margin-bottom: 80rpx">接收文件电子邮箱/ 接收文件微信/
接收文件寄件地址,以上三项选填一项即可</p>
<el-row :gutter="10">
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="申请人:" required>
<el-input v-model="requestName"/>
</el-form-item>
</el-col>
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="业务联系人:" required>
<el-input v-model="contactName"/>
</el-form-item>
</el-col>
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="业务咨询联系方式:" required>
<el-input v-model="contact"/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<view class="mt-40 flex justify-center items-center">
<view class="ml-35">客服联系方式: 0771-3923001</view>
</view>
<view class="flex justify-start items-center">
<el-checkbox v-model="agree">我已阅读并同意</el-checkbox>
<span class="text-main pointer font-bold" @click="showAgreement">《金久信自营交易协议》</span>
</view>
<view class="mt-40 flex justify-center items-center">
<el-button type="primary" @click="newOrder"
:disabled="companyList.length === 0 || !agree">
立即提交
</el-button>
</view>
</view>
</view>
<gap/>
<common-footer></common-footer>
</view>
</template>
<script>
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import Gap from "../../../components/gap/gap.vue";
export default {
name: "companyQuote",
components: {Gap},
data() {
return {
provinceData: provinces,
cityData: citys,
areaData: areas,
form: {},
configList: [],
checkList: [],
contentList: [],
contentNameList: [],
addressIndex: [[null, null, null]],
addressDetail: '',
receiveAddressIndex: [null, null, null],
receiveAddressDetail: '',
companyList: [
{
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
}
],
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
agreement: '',
agree: false,
contactList: []
}
},
methods: {
async getConfigList() {
const {rows} = await vk.callFunction({
url: 'client/coop/config/pub/getList',
data: {type: 2}
})
if (rows) {
this.configList = rows.map(item => {
item.contentIndex = null
item.amountIndex = null
item.num = null
return item
})
}
},
changeCheck(itemIndex, name) {
const index = this.contentList.indexOf(itemIndex)
if (index === -1) {
this.contentList.push(itemIndex)
this.contentNameList.push(name)
} else {
this.contentList.splice(index, 1)
this.contentNameList.splice(index, 1)
this.configList[itemIndex].contentIndex = null
this.configList[itemIndex].amountIndex = null
}
},
addCompany() {
this.companyList.push({
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
})
this.addressIndex.push([null, null, null])
this.receiveAddressIndex.push([null, null, null])
},
removeCompany(index) {
this.companyList.splice(index, 1)
this.addressIndex.splice(index, 1)
this.receiveAddressIndex.splice(index, 1)
},
async newOrder() {
const amountList = []
this.configList.forEach(item => {
item.contents.forEach((content, contentIndex) => {
if (contentIndex === item.contentIndex && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === item.amountIndex) {
amountList.push(`${content._index},${amount._index},${item.num}`)
}
})
}
})
})
if (amountList.length === 0) return this.$message({
message: '请至少选择一项服务',
type: 'error'
})
if (this.addressIndex[0][2] === null) return this.$message({
message: '请选择地址',
type: 'error'
})
if (!this.email && !this.wechat && this.receiveAddressIndex[0][2] === null) return this.$message({
message: '请选择接收文件地址/微信/邮箱',
type: 'error'
})
this.companyList.forEach((item, index) => {
const companyProvince = this.provinceData[this.addressIndex[index][0]]
const companyCity = this.cityData[this.addressIndex[index][0]][this.addressIndex[index][1]]
const companyArea = this.areaData[this.addressIndex[index][0]][this.addressIndex[index][1]][this.addressIndex[index][2]]
this.companyList[index].addressRegion = {
province: {code: companyProvince.code, name: companyProvince.name},
city: {code: companyCity.code, name: companyCity.name},
area: {code: companyArea.code, name: companyArea.name},
}
})
for (let i = 0; i < this.companyList.length; i++) {
if (!this.companyList[i].files || this.companyList[i].files.length === 0) return this.$message({
message: '请上传产品明细',
type: 'error'
})
if (!this.companyList[i].address) return this.$message({
type: 'error',
message: '请填写产品应用地址',
})
if (this.addressIndex[i][2] === null) return this.$message({
type: 'error',
message: '请填写产品应用地址',
})
}
if (!this.requestName) return this.$message({
type: 'error',
message: '请填写申请人',
})
if (!this.contactName) return this.$message({
type: 'error',
message: '请填写业务联系人姓名',
})
if (!this.contact) return this.$message({
type: 'error',
message: '请填写联系人电话',
})
if (this.receiveAddressIndex.length > 0 && this.receiveAddressIndex[2] !== null) {
const province = this.provinceData[this.receiveAddressIndex[0]]
const city = this.cityData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]]
const area = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]][this.receiveAddressIndex[2]]
this.receiveAddressRegion = {
province: {code: province.code, name: province.name},
city: {code: city.code, name: city.name},
area: {code: area.code, name: area.name},
}
}
const {data} = await vk.callFunction({
url: 'client/selfSupport/kh/addOrder',
title: '提交中...',
data: {
type: 2,
amountList,
contentList: this.companyList,
receiveAddressRegion: this.receiveAddressRegion,
email: this.email,
wechat: this.wechat,
receiveAddress: this.receiveAddress,
requestName: this.requestName,
contactName: this.contactName,
contact: this.contact,
}
})
this.$message({
type: 'success',
message: '已提交',
})
vk.navigateBack()
},
showAgreement() {
this.$confirm(this.agreement, '金久信自营交易协议', {
cancelButtonText: '关闭',
showConfirmButton: false,
dangerouslyUseHTMLString: true,
})
},
async getAgreement() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '65885d4c09664c1c8d8e8476'
},
})
this.agreement = res.content
},
demoDownload() {
vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6588642a99c624e89199fbb4'
},
success: res => {
window.open(res.content)
}
})
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
},
navTo() {
vk.navigateTo({url: '/pages/user/user?menu=business-contact'})
},
selectContact(name) {
const contact = this.contactList.find(item => item.name === name)
this.contact = contact.phone
},
changeAmountIndex(configIndex) {
const config = this.configList[configIndex]
if (config.contentIndex !== null && config.amountIndex !== null) {
this.configList[configIndex].num = config.contents[config.contentIndex].amountList[config.amountIndex].defaultNum
}
},
previewUpload({url}) {
window.open(url)
}
},
onLoad() {
const userInfo = vk.getVuex('$user.userInfo')
// console.log('userInfo', userInfo)
if (parseInt(userInfo.accountType) === 2) {
this.email = userInfo.company.contactEmail
this.requestName = userInfo.manager.personName
this.contactName = userInfo.manager.personName
this.contact = userInfo.company.mobile
if (userInfo.company && userInfo.company.addressRegion) {
this.receiveAddressIndex[0] = this.provinceData.findIndex(item => item.name === userInfo.company.addressRegion.province.name)
this.receiveAddressIndex[1] = this.cityData[this.receiveAddressIndex[0]].findIndex(item => item.name === userInfo.company.addressRegion.city.name)
this.receiveAddressIndex[2] = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]].findIndex(item => item.name === userInfo.company.addressRegion.area.name)
}
if (userInfo.company.addressDetail) this.receiveAddress = userInfo.company.addressDetail
} else {
if (userInfo.businessCard && userInfo.businessCard.email) this.email = userInfo.businessCard.email
this.requestName = userInfo.person.personName
this.contactName = userInfo.person.personName
this.contact = userInfo.person.mobile
if (userInfo.person && userInfo.person.addressRegion) {
this.receiveAddressIndex[0] = this.provinceData.findIndex(item => item.name === userInfo.person.addressRegion.province.name)
this.receiveAddressIndex[1] = this.cityData[this.receiveAddressIndex[0]].findIndex(item => item.name === userInfo.person.addressRegion.city.name)
this.receiveAddressIndex[2] = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]].findIndex(item => item.name === userInfo.person.addressRegion.area.name)
}
if (userInfo.person.addressDetail) this.receiveAddress = userInfo.person.addressDetail
}
this.getAgreement()
this.getConfigList()
// this.getContactList()
},
computed: {
amount() {
let tmpAmount = 0
this.configList.forEach(item => {
item.contents.forEach((content, contentIndex) => {
if (contentIndex === item.contentIndex && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === item.amountIndex) {
tmpAmount += parseFloat(amount.amount)
}
})
}
})
})
return tmpAmount
},
totalAmount() {
return this.amount * this.companyList.length
}
}
}
</script>
<style lang="scss" scoped>
.server-item {
background-color: #fbf8f8;
border: 2px solid #fbebf1;
padding: 10px;
display: flex;
justify-content: space-between;
margin-bottom: 20px;
.items-center {
width: 1100px;
display: flex;
justify-content: space-between;
align-items: center;
flex: 1;
view {
width: 300px;
}
.ml-35 {
font-weight: normal;
font-size: 13px;
}
}
.server-item-content {
display: flex;
align-items: center;
flex: 1;
//width: 600px !important;
}
.remark {
color: #999999;
font-weight: normal;
}
}
.divider-title {
font-size: 17px;
font-weight: bold;
}
</style>
+593 -344
View File
@@ -1,193 +1,270 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<u-swiper :list="list" :height="380" borderRadius="0"></u-swiper>
<view class="bg-white p-40">
<view v-for="(item, index) in configList" :key="index"
class="my-20 flex flex-col justify-start items-start">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center text-35 mb-20">
<text>服务内容:{{ item.name }}</text>
<view class="flex flex-col justify-start items-start">
<view v-for="(content, contentIndex) in item.contents" :key="contentIndex"
class="mb-40 flex justify-start items-center">
<view class="ml-35">
<text>业务编号:</text>
<text>{{ content.code }}</text>
</view>
<view class="flex justify-start items-center">
<text class="ml-35">服务服务项目:</text>
<el-checkbox v-model="configList[index].contents[contentIndex].checked"
@change="selectContent(content)"
:disabled="!content.amountList || content.amountList.length === 0">
{{ content.title }}
</el-checkbox>
</view>
<view class="flex justify-start items-center ml-35">
<el-select v-model="configList[index].contents[contentIndex].amountIndex"
clearable
:disabled="!content.amountList || content.amountList.length === 0">
<el-option v-for="(amount, amountIndex) in content.amountList"
:key="amountIndex"
:label="amount.title" :value="amountIndex"/>
</el-select>
<text class="ml-35" v-if="content.amountIndex !== null">
{{ content.amountList[content.amountIndex].amount }}元/次
</text>
</view>
</view>
</view>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<common-swiper page="self-support-product-swiper"/>
<view class="flex justify-end items-center text-main pointer my-20 " @click="demoDownload">示例下载</view>
</view>
<view>备注: {{ item.remark }}</view>
</view>
<view class="bg-white p-40">
<view v-for="(item, index) in configList" :key="index"
class="server-item my-20 flex flex-col justify-start items-start">
<el-checkbox @change="changeCheck(index, item.name)">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center text-35 mb-20">
<view class="name">{{ item.name }}</view>
<view class="ml-15">
<text>业务编号:</text>
<text v-if="item.contentIndex !== null">{{
item.contents[item.contentIndex].code
}}
</text>
</view>
<el-form ref="form" :model="form" label-width="200px">
<view v-for="(item, productIndex) in productList" :key="productIndex">
<el-form-item label="检测产品:" required>
<el-input v-model="productList[productIndex].name"/>
</el-form-item>
<el-form-item label="检测内容">
{{ contentNameList.join() }}
</el-form-item>
<el-form-item label="取样所在地">
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="addressIndex[productIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[productIndex][1]" placeholder="请选择市"
:disabled="addressIndex[productIndex].length === 0">
<template v-if="addressIndex[productIndex][0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[productIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[productIndex][2]" placeholder="请选择区"
:disabled="addressIndex[productIndex].length === 1">
<template
v-if="addressIndex[productIndex][0] !== null && addressIndex[productIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[addressIndex[productIndex][0]][addressIndex[productIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="productList[productIndex].address" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="接收文件电子邮箱:">
<el-input v-model="productList[productIndex].email"/>
</el-form-item>
<el-form-item label="接收文件微信:">
<el-input v-model="productList[productIndex].wechat"/>
</el-form-item>
<el-form-item label="接收文件寄件地址">
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="receiveAddressIndex[productIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[productIndex][1]" placeholder="请选择市"
:disabled="receiveAddressIndex[productIndex].length === 0">
<template v-if="receiveAddressIndex[productIndex][0] !== null">
<el-option
v-for="(item, index) in cityData[receiveAddressIndex[productIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[productIndex][2]" placeholder="请选择区"
:disabled="receiveAddressIndex[productIndex].length === 1">
<template
v-if="receiveAddressIndex[productIndex][0] !== null && receiveAddressIndex[productIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[receiveAddressIndex[productIndex][0]][receiveAddressIndex[productIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="productList[productIndex].receiveAddress" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="申请人:">
<el-input v-model="productList[productIndex].requestName"/>
</el-form-item>
<el-form-item label="联系人:">
<el-input v-model="productList[productIndex].contactName"/>
</el-form-item>
<el-form-item label="联系方式:">
<el-input v-model="productList[productIndex].contact"/>
</el-form-item>
<el-form-item label="本次服务费用小计:">
<view class="flex justify-between items-start mb-20 w-100p">
<view class="flex justify-start items-center">
<el-input v-model="amount" disabled/>
<view class="ml-20">
<el-button type="primary" @click.native="addProduct">增加考察对象
</el-button>
</view>
<view class="ml-20">
<el-button type="primary" plain @click.native="removeProduct(productIndex)"
class="ml-20"
:disabled="productList.length === 1">删除该对象
</el-button>
</view>
</view>
</view>
</el-form-item>
</view>
</el-form>
<view class="mt-40 flex justify-center items-center">
<view class="flex justify-center items-center">
<text>总价:</text>
<text class="text-main font-bold text-35">{{ totalAmount }}元</text>
</view>
<view class="ml-35">客服联系方式: 0771-3923001</view>
<view class="server-item-content">
<text class="ml-15">服务项目:</text>
<el-select v-model="configList[index].contentIndex" clearable
:disabled="!contentList.includes(index)">
<el-option v-for="(content, contentIndex) in item.contents" :key="contentIndex"
:label="content.title" :value="contentIndex"/>
</el-select>
<template v-if="item.contentIndex !== null">
<el-select v-model="configList[index].amountIndex"
clearable class="ml-15">
<el-option
v-for="(amount, amountIndex) in item.contents[item.contentIndex].amountList"
:key="amountIndex"
:label="amount.title" :value="amountIndex"/>
</el-select>
</template>
</view>
<view class="mt-40 flex justify-center items-center">
<el-button type="primary" @click.native="newOrder"
:disabled="productList.length === 0 || !productList[0].name">
立即支付
</el-button>
<text>金额:</text>
<view class="ml-15" v-if="item.contentIndex !== null && item.amountIndex !== null">
{{ item.contents[item.contentIndex].amountList[item.amountIndex].amount }}元/次
</view>
<view class="ml-15" v-else>
元/次
</view>
<el-button type="primary" size="small"
@click="addToAmountList(index, configList[index].contentIndex, item.amountIndex)"
:disabled="item.amountIndex === null">
添加
</el-button>
</view>
<view class="remark">备注: {{ item.remark }}</view>
</view>
</el-checkbox>
</view>
<gap/>
<common-footer></common-footer>
<el-form ref="form" :model="form" label-width="200px">
<view v-for="(item, productIndex) in productList" :key="productIndex">
<el-form-item label="检测产品:" required>
<el-input v-model="productList[productIndex].name"/>
</el-form-item>
<el-form-item label="文档上传:">
<vk-data-upload v-model="productList[productIndex].files" list-type="text"
:on-preview="previewUpload"
accept=".jpg,.jpeg,.png,.xlsx,.doc,.docx,.pdf">
</vk-data-upload>
</el-form-item>
<el-form-item label="检测内容">
{{ contentNameList.join() }}
</el-form-item>
<el-form-item label="取样所在地">
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="addressIndex[productIndex][0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[productIndex][1]" placeholder="请选择市"
:disabled="addressIndex[productIndex].length === 0">
<template v-if="addressIndex[productIndex][0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[productIndex][0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[productIndex][2]" placeholder="请选择区"
:disabled="addressIndex[productIndex].length === 1">
<template
v-if="addressIndex[productIndex][0] !== null && addressIndex[productIndex][1] !== null">
<el-option
v-for="(item, index) in areaData[addressIndex[productIndex][0]][addressIndex[productIndex][1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="productList[productIndex].address" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="本次服务费用小计:">
<view class="flex justify-between items-start mb-20 w-100p">
<view class="flex justify-start items-center">
<el-input v-model="amount" disabled/>
</view>
<view class="ml-20">
<el-button type="primary" plain @click.native="removeProduct(productIndex)"
class="ml-20"
:disabled="productList.length === 1">删除该对象
</el-button>
</view>
</view>
</el-form-item>
<el-divider/>
</view>
<el-form-item label="接收文件电子邮箱:">
<el-input v-model="email"/>
</el-form-item>
<el-form-item label="接收文件微信:">
<el-input v-model="wechat"/>
</el-form-item>
<el-form-item label="接收文件寄件地址">
<el-row :gutter="10">
<el-col :span="4">
<el-select v-model="receiveAddressIndex[0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[1]" placeholder="请选择市"
:disabled="receiveAddressIndex.length === 0">
<template v-if="receiveAddressIndex[0] !== null">
<el-option
v-for="(item, index) in cityData[receiveAddressIndex[0]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="receiveAddressIndex[2]" placeholder="请选择区"
:disabled="receiveAddressIndex.length === 1">
<template
v-if="receiveAddressIndex[0] !== null && receiveAddressIndex[1] !== null">
<el-option
v-for="(item, index) in areaData[receiveAddressIndex[0]][receiveAddressIndex[1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="11">
<el-input v-model="receiveAddress"
placeholder="请输入详细地址"/>
</el-col>
</el-row>
</el-form-item>
<p class="text-main text-25 text-center" style="margin-bottom: 80rpx">接收文件电子邮箱/ 接收文件微信/
接收文件寄件地址,以上三项选填一项即可</p>
<!-- <el-form-item label="申请人:">-->
<!-- <el-input v-model="requestName"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="联系人:">-->
<!-- <el-input v-model="contactName"/>-->
<!-- </el-form-item>-->
<!-- <el-form-item label="联系方式:">-->
<!-- <el-input v-model="contact"/>-->
<!-- </el-form-item>-->
<el-row :gutter="10">
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="申请人:" required>
<el-input v-model="requestName"/>
</el-form-item>
</el-col>
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="业务联系人:" required>
<el-input v-model="contactName"/>
</el-form-item>
</el-col>
<el-col :span="8" class="flex justify-start items-center">
<el-form-item label="业务咨询联系方式:" required>
<el-input v-model="contact"/>
</el-form-item>
</el-col>
<!-- <el-col :span="8" class="flex justify-start items-center">-->
<!-- <el-form-item label="联系人:" required>-->
<!-- <el-select v-model="contactName" placeholder="点击选择业务联系人"-->
<!-- class="w-100p" @change="selectContact">-->
<!-- <el-option-->
<!-- v-for="(item, index) in contactList"-->
<!-- :key="index"-->
<!-- :label="item.name"-->
<!-- :value="item.name">-->
<!-- </el-option>-->
<!-- <view slot="empty" class="text-gray pointer p-20">-->
<!-- <text>无业务联系人,请到</text>-->
<!-- <text class="text-main mx-15" @click="navTo">个人中心</text>-->
<!-- <text>添加</text>-->
<!-- </view>-->
<!-- </el-select>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!-- <el-col :span="8" class="flex justify-start items-center">-->
<!-- <el-form-item label="业务咨询联系方式:" required>-->
<!-- <el-input v-model="contact" type="number" disabled/>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
<el-form-item label="备注:">
<el-input v-model="remark"/>
</el-form-item>
<el-button type="primary" @click.native="addProduct">增加考察对象
</el-button>
</el-form>
<view class="mt-20">
<view>已选项目:</view>
<view v-for="(item, index) in amountList" :key="index" class="mt-20 flex justify-start items-center">
<el-button type="primary" size="small" @click="removeFromAmountList(index)">删除</el-button>
<p class="ml-20">{{ configList[item.index].name }} -- {{ configList[item.index].contents[item.contentIndex].title }} --
{{
configList[item.index].contents[item.contentIndex].amountList[item.amountIndex].title
}},{{ configList[item.index].contents[item.contentIndex].amountList[item.amountIndex].amount }}元</p>
</view>
</view>
<view class="mt-40 flex justify-center items-center">
<view class="flex justify-center items-center">
<text>总价:</text>
<text class="text-main font-bold text-35">{{ totalAmount }}元</text>
</view>
<view class="ml-35">客服联系方式: 0771-3923001</view>
</view>
<view class="flex justify-start items-center">
<el-checkbox v-model="agree">我已阅读并同意</el-checkbox>
<span class="text-main pointer font-bold" @click="showAgreement">《金久信自营交易协议》</span>
</view>
<view class="mt-40 flex justify-center items-center">
<el-button type="primary" @click.native="newOrder"
:disabled="productList.length === 0 || !productList[0].name || !agree">
立即支付
</el-button>
</view>
</view>
</view>
<gap/>
<common-footer></common-footer>
</view>
</template>
<script>
@@ -196,168 +273,340 @@ import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
export default {
name: "productQuote",
data() {
return {
provinceData: provinces,
cityData: citys,
areaData: areas,
list: [
{
image: '/static/images/selfSupport/swiper.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
],
form: {},
configList: [],
checkList: [],
contentList: [],
contentNameList: [],
addressIndex: [[null, null, null]],
addressDetail: '',
receiveAddressIndex: [[null, null, null]],
receiveAddressDetail: '',
productList: [
{
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
}
],
}
},
methods: {
async getConfigList() {
const {rows} = await vk.callFunction({
url: 'client/coop/config/pub/getList',
data: {type: 1}
})
if (rows) {
this.configList = rows.map(item => {
item.contents.map(content => {
content.checked = false
content.amountIndex = null
return content
})
return item
})
}
},
addProduct() {
this.productList.push({
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
})
this.addressIndex.push([null, null, null])
this.receiveAddressIndex.push([null, null, null])
},
removeProduct(index) {
this.productList.splice(index, 1)
this.addressIndex.splice(index, 1)
this.receiveAddressIndex.splice(index, 1)
},
selectContent(content) {
const index = this.contentNameList.indexOf(content.title)
if (index === -1) this.contentNameList.push(content.title)
else this.contentNameList.splice(index, 1)
},
async newOrder() {
const amountList = []
this.configList.forEach(item => {
item.contents.forEach(content => {
if (content.checked && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === content.amountIndex) {
amountList.push(amount._index)
}
})
}
})
})
if (amountList.length === 0) return this.$message({
message: '请至少选择一项服务',
type: 'error'
})
this.productList.forEach((item, index) => {
this.productList[index].addressRegion = {
province: this.provinceData[this.addressIndex[index][0]],
city: this.cityData[this.addressIndex[index][0]][this.addressIndex[index][1]],
area: this.areaData[this.addressIndex[index][0]][this.addressIndex[index][1]][this.addressIndex[index][2]],
}
this.productList[index].receiveAddressRegion = {
province: this.provinceData[this.receiveAddressIndex[index][0]],
city: this.cityData[this.receiveAddressIndex[index][0]][this.receiveAddressIndex[index][1]],
area: this.areaData[this.receiveAddressIndex[index][0]][this.receiveAddressIndex[index][1]][this.receiveAddressIndex[index][2]],
}
})
const {data} = await vk.callFunction({
url: 'client/selfSupport/kh/addOrder',
data: {
type: 1,
amountList,
contentList: this.productList
}
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
},
},
onLoad() {
this.getConfigList()
},
computed: {
amount() {
let tmpAmount = 0
this.configList.forEach(item => {
item.contents.forEach(content => {
if (content.checked && content.amountList.length > 0) {
content.amountList.forEach((amount, amountIndex) => {
if (amountIndex === content.amountIndex) {
tmpAmount += parseFloat(amount.amount)
}
})
}
})
})
return tmpAmount
},
totalAmount() {
return this.amount * this.productList.length
name: "productQuote",
data() {
return {
provinceData: provinces,
cityData: citys,
areaData: areas,
form: {},
configList: [],
checkList: [],
contentList: [],
contentNameList: [],
addressIndex: [[null, null, null]],
addressDetail: '',
receiveAddressIndex: [null, null, null],
receiveAddressDetail: '',
productList: [
{
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
}
],
email: '',
wechat: '',
receiveAddressRegion: {
province: null,
city: null,
area: null,
},
receiveAddress: '',
requestName: '',
contactName: '',
contact: '',
remark: '',
agreement: '',
agree: false,
contactList: [],
files: [],
amountList: []
}
},
methods: {
async getConfigList() {
const {rows} = await vk.callFunction({
url: 'client/coop/config/pub/getList',
data: {type: 1}
})
if (rows) {
this.configList = rows.map(item => {
item.contentIndex = null
item.amountIndex = null
return item
})
}
},
addProduct() {
this.productList.push({
name: '',
code: '',
addressRegion: {
province: null,
city: null,
area: null,
},
address: '',
})
this.addressIndex.push([null, null, null])
},
removeProduct(index) {
this.productList.splice(index, 1)
this.addressIndex.splice(index, 1)
},
addToAmountList(index, contentIndex, amountIndex) {
this.amountList.push({
index,
contentIndex,
amountIndex,
contentIndexVal: this.configList[index].contents[contentIndex]._index,
amountIndexVal: this.configList[index].contents[contentIndex].amountList[amountIndex]._index,
amount: this.configList[index].contents[contentIndex].amountList[amountIndex].amount
})
this.configList[index].contentIndex = null
this.configList[index].amountIndex = null
},
removeFromAmountList(index) {
this.amountList.splice(index, 1)
},
async newOrder() {
// const amountList = []
// this.configList.forEach(item => {
// item.contents.forEach((content, contentIndex) => {
// if (contentIndex === item.contentIndex && content.amountList.length > 0) {
// content.amountList.forEach((amount, amountIndex) => {
// if (amountIndex === item.amountIndex) {
// amountList.push(`${content._index},${amount._index}`)
// }
// })
// }
// })
// })
if (this.amountList.length === 0) return this.$message({
message: '请至少选择一项服务',
type: 'error'
})
if (!this.email && !this.wechat && this.receiveAddressIndex[0][2] === null) return this.$message({
message: '请选择接收文件地址/微信/邮箱',
type: 'error'
})
if (!this.requestName) return this.$message({
type: 'error',
message: '请填写申请人',
})
if (!this.contactName) return this.$message({
type: 'error',
message: '请填写联系人姓名',
})
if (!this.contact) return this.$message({
type: 'error',
message: '请填写联系人电话',
})
for (let i = 0; i < this.productList.length; i++) {
if (!this.productList[i].name) return this.$message({
message: '请填写考察产品名称',
type: 'error'
})
if (!this.productList[i].address) return this.$message({
type: 'error',
message: '请填写考察产品地址',
})
if (this.addressIndex[i][2] === null) return this.$message({
type: 'error',
message: '请填写考察产品地址',
})
}
if (this.receiveAddressIndex.length > 0 && this.receiveAddressIndex[2] !== null) {
const province = this.provinceData[this.receiveAddressIndex[0]]
const city = this.cityData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]]
const area = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]][this.receiveAddressIndex[2]]
this.receiveAddressRegion = {
province: {code: province.code, name: province.name},
city: {code: city.code, name: city.name},
area: {code: area.code, name: area.name},
}
}
this.productList.forEach((item, index) => {
const companyProvince = this.provinceData[this.addressIndex[index][0]]
const companyCity = this.cityData[this.addressIndex[index][0]][this.addressIndex[index][1]]
const companyArea = this.areaData[this.addressIndex[index][0]][this.addressIndex[index][1]][this.addressIndex[index][2]]
this.productList[index].addressRegion = {
province: {code: companyProvince.code, name: companyProvince.name},
city: {code: companyCity.code, name: companyCity.name},
area: {code: companyArea.code, name: companyArea.name},
}
})
const {data} = await vk.callFunction({
url: 'client/selfSupport/kh/addOrder',
title: '请求中...',
data: {
type: 1,
amountList: this.amountList.map(item => `${item.contentIndexVal},${item.amountIndexVal}`),
contentList: this.productList,
receiveAddressRegion: this.receiveAddressRegion,
email: this.email,
wechat: this.wechat,
receiveAddress: this.receiveAddress,
requestName: this.requestName,
contactName: this.contactName,
contact: this.contact,
remark: this.remark,
}
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
},
changeCheck(itemIndex, name) {
const index = this.contentList.indexOf(itemIndex)
if (index === -1) {
this.contentList.push(itemIndex)
this.contentNameList.push(name)
} else {
this.contentList.splice(index, 1)
this.contentNameList.splice(index, 1)
this.configList[itemIndex].contentIndex = null
this.configList[itemIndex].amountIndex = null
}
},
showAgreement() {
this.$confirm(this.agreement, '金久信自营交易协议', {
cancelButtonText: '关闭',
showConfirmButton: false,
dangerouslyUseHTMLString: true,
})
},
async getAgreement() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '65885d4c09664c1c8d8e8476'
},
})
this.agreement = res.content
},
demoDownload() {
vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '6588648da7c432e4a360bb34'
},
success: res => {
window.open(res.content)
}
})
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
},
navTo() {
vk.navigateTo({url: '/pages/user/user?menu=business-contact'})
},
selectContact(name) {
const contact = this.contactList.find(item => item.name === name)
this.contact = contact.phone
},
previewUpload({url}) {
window.open(url)
}
},
onLoad() {
const userInfo = vk.getVuex('$user.userInfo')
// console.log('userInfo', userInfo)
if (parseInt(userInfo.accountType) === 2) {
this.email = userInfo.company.contactEmail
this.requestName = userInfo.manager.personName
this.contactName = userInfo.manager.personName
this.contact = userInfo.company.mobile
if (userInfo.company && userInfo.company.addressRegion) {
this.receiveAddressIndex[0] = this.provinceData.findIndex(item => item.name === userInfo.company.addressRegion.province.name)
this.receiveAddressIndex[1] = this.cityData[this.receiveAddressIndex[0]].findIndex(item => item.name === userInfo.company.addressRegion.city.name)
this.receiveAddressIndex[2] = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]].findIndex(item => item.name === userInfo.company.addressRegion.area.name)
}
if (userInfo.company.addressDetail) this.receiveAddress = userInfo.company.addressDetail
} else {
if (userInfo.businessCard && userInfo.businessCard.email) this.email = userInfo.businessCard.email
this.requestName = userInfo.person.personName
this.contactName = userInfo.person.personName
this.contact = userInfo.person.mobile
if (userInfo.person && userInfo.person.addressRegion) {
this.receiveAddressIndex[0] = this.provinceData.findIndex(item => item.name === userInfo.person.addressRegion.province.name)
this.receiveAddressIndex[1] = this.cityData[this.receiveAddressIndex[0]].findIndex(item => item.name === userInfo.person.addressRegion.city.name)
this.receiveAddressIndex[2] = this.areaData[this.receiveAddressIndex[0]][this.receiveAddressIndex[1]].findIndex(item => item.name === userInfo.person.addressRegion.area.name)
}
if (userInfo.person.addressDetail) this.receiveAddress = userInfo.person.addressDetail
}
this.getConfigList()
this.getAgreement()
// this.getContactList()
},
computed: {
amount() {
let tmpAmount = 0
// this.configList.forEach(item => {
// item.contents.forEach((content, contentIndex) => {
// if (contentIndex === item.contentIndex && content.amountList.length > 0) {
// content.amountList.forEach((amount, amountIndex) => {
// if (amountIndex === item.amountIndex) {
// tmpAmount += parseFloat(amount.amount)
// }
// })
// }
// })
// })
this.amountList.forEach(item => {
tmpAmount += item.amount
})
return tmpAmount
},
totalAmount() {
return this.amount * this.productList.length
}
}
}
</script>
</script>
<style lang="scss" scoped>
.server-item {
background-color: #fbf8f8;
border: 2px solid #fbebf1;
padding: 10px;
display: flex;
justify-content: space-between;
margin-bottom: 20px;
.items-center {
width: 1100px;
display: flex;
justify-content: space-between;
align-items: center;
flex: 1;
view {
width: 300px;
}
.ml-35 {
font-weight: normal;
font-size: 13px;
}
}
.server-item-content {
display: flex;
align-items: center;
width: 600px !important;
}
.remark {
color: #999999;
font-weight: normal;
}
}
.divider-title {
font-size: 17px;
font-weight: bold;
}
</style>
+214
View File
@@ -0,0 +1,214 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="page-nav">
<el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>
<navigator style="display: inline-block;" url="/pages/self-support/self-support">金久信自营</navigator>
</el-breadcrumb-item>
<el-breadcrumb-item>填写报价信息</el-breadcrumb-item>
</el-breadcrumb>
</view>
<view class="page-main">
<quote-remain-num v-if="reloaded"/>
<vk-data-form
ref="form1"
v-model="form1.data"
:action="form1.props.action"
:columns="form1.props.columns"
:rules="form1.props.rules"
:form-type="form1.props.formType"
:loading.sync="form1.props.loading"
:auto-close="false"
:show-cancel="false"
label-width="160px"
@success="onFormSuccess"
>
<template v-slot:desc>
<span>{{ sheet.desc }}</span>
</template>
<template v-slot:amount>
<el-input v-model="form1.data.amount" placeholder="请输入货款总价" @change="formatNumber"></el-input>
</template>
<template v-slot:sheetFile="{ row, column, index }">
<p v-for="(item, index) in sheet.files" :key="index" class="text-main">
<a :href="item" target="_blank">预览:文件{{index + 1}}</a>
</p>
</template>
</vk-data-form>
</view>
<common-footer></common-footer>
</view>
</template>
<script>
export default {
data() {
return {
reloaded: false,
// 表单相关开始-----------------------------------------------------------
form1: {
// 表单请求数据,此处可以设置默认值
data: {
// radio: 1,
// checkbox : [1,2]
sheetId: null,
amount: null,
},
// 表单属性
props: {
// 表单请求地址
action: "client/selfSupport/kh/addQuote",
// 表单字段显示规则
columns: [
{key: "sheetFile", title: "询价文件", type: "html"},
{key: "desc", title: "产品描述", type: "html"},
{key: "amount", title: "货款总价(人民币:元)", type: "html"},
{key: "files", title: "附件", type: "file", accept: '.pdf'},
{key: "remark", title: "报价单详情", type: "textarea"},
],
// 表单验证规则
rules: {
amount: [
{required: true, message: "货款总价不能为空", trigger: "change,blur"},
]
},
// add 代表添加 update 代表修改
formType: "",
// 表单是否在请求中
loading: false,
// 是否显示表单1 的弹窗
show: false
}
},
// 表单相关结束-----------------------------------------------------------
sheet: null
};
},
onLoad(options = {}) {
console.log(options)
const {
id
} = options
if (!id) {
vk.navigateTo('/pages/self-support/self-support');
return
}
this.enquiryId = id
this.form1.data.sheetId = id
this.getEnquiryDetail()
},
computed: {
totalPriceStr() {
if (this.totalPrice == 0) {
return "零元"
}
return vk.myfn.convertCurrency(this.totalPrice / 100)
}
},
methods: {
onFormSuccess() {
vk.redirectTo({url: `/pages/index/index`})
},
// 提交报价单
async submit() {
const data = await vk.userCenter.getCurrentUserInfo();
const {userInfo} = data
if (userInfo.remainQuoteNum === 0 || !userInfo.remainQuoteNum) {
}
// this.$confirm(`今日报价次数${userInfo.quoteTimes || 0}, 是否继续?`, '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning',
// center: true
// }).then(res => {
//
// })
vk.callFunction({
url: 'client/enquiry/quote/kh/addQuote',
title: '请求中...',
// data: {
// sheet: this.sheet,
// totalPrice: this.totalPrice
// },
success: (data) => {
this.$message({
message: "报价成功",
type: 'success'
})
}
});
},
/**
* 获取询价单详情
*/
getEnquiryDetail() {
vk.callFunction({
url: 'client/selfSupport/kh/getDetail',
title: '请求中...',
data: {
_id: this.enquiryId
},
success: (res) => {
this.sheet = res
}
});
},
formatNumber(e){
this.form1.data.amount = parseFloat(this.form1.data.amount).toFixed(2)
}
},
onShow() {
this.reloaded = false
setTimeout(() => {
this.reloaded = true
}, 500)
}
}
</script>
<style lang="scss" scoped>
.page-main {
width: 1200px;
margin: 20px auto;
background-color: #FFFFFF;
padding: 20px;
}
.description {
margin-bottom: 40px;
width: 800px;
}
.quote {
display: flex;
align-items: center;
justify-content: space-between;
}
.quote-form {
width: 260px;
}
.form-footer {
height: 40px;
line-height: 40px;
background: #fff;
padding-top: 0;
text-align: center;
display: block;
}
</style>
+79 -28
View File
@@ -1,38 +1,89 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<u-swiper :list="list" :height="380" borderRadius="0"></u-swiper>
<view class="flex flex-col">
<image src="/static/images/selfSupport/company.jpg" class="w-100p pointer" mode="widthFix"
@click="navTo('/pages/index/self-support/companyQuote')"/>
<image src="/static/images/selfSupport/product.jpg" class="w-100p pointer mt-20" mode="widthFix"
@click="navTo('/pages/index/self-support/productQuote')"/>
</view>
</view>
<common-footer></common-footer>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<!-- <el-carousel :height="`500px`" :style="{width: '1200px'}" class="m-a">-->
<!-- <el-carousel-item v-for="(item, index) in list" :key="index" :style="{width: '1200px'}">-->
<!-- <image :src="item.image" mode="scaleToFill" :style="{width: '1200px', height: '500px'}"/>-->
<!-- </el-carousel-item>-->
<!-- </el-carousel>-->
<common-swiper page="self-support-main"/>
<view class="flex flex-col">
<image :src="companyImg" class="w-100p pointer"
style="height: 150px"
@click="navTo('/pages/index/self-support/companyQuote')"/>
<image :src="productImg" class="w-100p pointer mt-20"
style="height: 150px"
@click="navTo('/pages/index/self-support/productQuote')"/>
<image :src="costImg" class="w-100p pointer mt-20"
style="height: 150px"
@click="navTo('/pages/index/self-support/costQuote')"/>
</view>
</view>
<common-footer></common-footer>
</view>
</template>
<script>
export default {
name: "selectType",
data() {
return {
list: [
{
image: '/static/images/selfSupport/swiper.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
]
}
},
methods: {
navTo(url) {
vk.navigateTo(url);
name: "selectType",
data() {
return {
list: [
{
image: '/static/images/selfSupport/swiper.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
],
companyImg: '',
productImg: '',
costImg: '',
}
},
methods: {
navTo(url) {
vk.navigateTo(url);
},
async getCompanyImg(){
vk.callFunction({
url: 'client/album/pub/list',
data: {
page: 'self-support-company'
},
success: ({swiper}) => {
this.companyImg = swiper[0]
}
})
},
async getProductImg(){
vk.callFunction({
url: 'client/album/pub/list',
data: {
page: 'self-support-product'
},
success: ({swiper}) => {
this.productImg = swiper[0]
}
})
},
async getCostImg(){
vk.callFunction({
url: 'client/album/pub/list',
data: {
page: 'self-support-quote'
},
success: ({swiper}) => {
this.costImg = swiper[0]
}
})
},
},
onLoad(){
this.getCompanyImg()
this.getProductImg()
this.getCostImg()
}
}
</script>
+344 -186
View File
@@ -1,215 +1,373 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200">
<u-swiper :list="list" :height="380" borderRadius="0"></u-swiper>
<view class="test">
<text class="pointer" @click="navTo('/pages/index/self-support/self-support')">自营钢城</text>
<text class="pointer" @click="navTo('/pages/index/self-support/selectType')">平台服务</text>
<text class="pointer" @click="navTo('/pages/index/shop/shop')">特产商城</text>
</view>
<view class="tool-bar">
<view class="search">
<text>交易区域:</text>
<el-cascader :options="options" :props="{label: 'name', value: 'code'}" v-model="address"
@change="getCompanyList" clearable/>
</view>
<view class="buy-btn">
<el-button type="primary" plain class="empty-bg-plain-btn" :disabled="address.length === 0"
@click.native="dialogVisible = true">
下单询价>
</el-button>
</view>
</view>
<!-- 合作单位/联营单位-->
<view class="cooperate">
<view class="title">合作单位/联营单位</view>
<u-gap height="5" bg-color="#f3f3f3"/>
<view class="flex justify-start items-start flex-wrap">
<view class="w-25p pointer" v-for="(item, index) in companyList" :key="index">
<view class="border bg-white flex flex-col justify-center items-center p-20">
<image :src="item.businessCard.logo" class="logo"/>
<span class="mt-20 line-1 w-100p text-center">
主营: {{ item.businessCard.mainBusiness }}
</span>
</view>
</view>
</view>
<u-gap height="5" bg-color="#f3f3f3"/>
</view>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200">
<view class="test">
<text class="pointer active" @click="navTo('/pages/index/self-support/self-support')">自营钢城</text>
<text class="pointer" @click="navTo('/pages/index/self-support/selectType')">平台服务</text>
<text class="pointer" @click="navTo('/pages/index/shop/shop')">特产商城</text>
</view>
<common-swiper page="self-support-index"/>
<view class="tool-bar">
<view class="search">
<text>交易区域:</text>
<el-cascader :options="options" :props="{label: 'name', value: 'code'}" v-model="address"
clearable @change="getCompanyList"/>
</view>
<!-- 现货市场 end -->
<gap height="50"/>
<right-bar></right-bar>
<common-footer></common-footer>
<el-dialog
title="下询价单"
:visible.sync="dialogVisible"
width="60%">
<vk-data-upload v-model="files" accept="*">
</vk-data-upload>
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="addFiles">确 定</el-button>
</el-dialog>
<view class="flex justify-end items-start">
<view class="flex flex-col justify-center items-center mr-10">
<el-button type="primary" plain class="empty-bg-plain-btn" :disabled="address.length === 0"
@mouseenter.native="showTips = true"
@mouseleave.native="showTips = false"
@click.native="dialogVisible = true">
下单询价>
</el-button>
<text class="text-main mt-10 text-20" v-if="showTips && address.length === 0">请先选择交易区域</text>
</view>
<el-button type="primary" @click.native="getList">
我的询价
</el-button>
</view>
</view>
<!-- 合作单位/联营单位-->
<view class="cooperate">
<view class="title">合作单位/联营单位</view>
<u-gap height="5" bg-color="#f3f3f3"/>
<view class="flex justify-start items-start flex-wrap">
<view class="w-25p pointer" v-for="(item, index) in companyList" :key="index"
@click="navTo(`/pages/yellowPage/info?id=${item.uid}`)">
<view class="border bg-white flex justify-start items-center p-20">
<image v-if="item.businessCard" :src="item.businessCard.logo" class="logo"/>
<image v-else src="/static/images/no-logo.jpg" class="logo" mode="aspectFill"/>
<div class="flex flex-col justify-start items-start ml-20 w-67p">
<span class="text-30 font-bold mb-25">{{ item.company.companyName }}</span>
<span class="mt-20 line-2 w-100p">
主营: {{
(item.mainSpotCategory && item.mainSpotCategory.length > 0) ? item.mainSpotCategory.join() : ''
}}
</span>
</div>
</view>
</view>
</view>
<u-gap height="5" bg-color="#f3f3f3"/>
</view>
</view>
<!-- 现货市场 end -->
<gap height="50"/>
<right-bar></right-bar>
<common-footer></common-footer>
<el-dialog
title="下询价单"
:visible.sync="dialogVisible"
width="60%">
<el-form ref="form" label-width="140px">
<el-form-item label="联系人" required>
<el-select v-model="name" placeholder="点击选择业务联系人"
class="w-100p" @change="selectContact">
<el-option
v-for="(item, index) in contactList"
:key="index"
:label="item.name"
:value="item.name">
</el-option>
<view slot="empty" class="text-gray pointer p-20">
<text>无业务联系人,请到</text>
<text class="text-main mx-15" @click="navToContact">个人中心</text>
<text>添加</text>
</view>
</el-select>
</el-form-item>
<el-form-item label="联系方式" required>
<el-input v-model="phone" placeholder="请输入联系方式" disabled/>
</el-form-item>
<el-form-item label="用户名称" required>
<el-input v-model="company" placeholder="请输入您的名称"/>
</el-form-item>
<el-form-item label="询价单附件" required>
<vk-data-upload v-model="files" list-type="text" accept="*" :on-preview="previewUpload">
</vk-data-upload>
<!-- <p class="text-main text-25">平台目前仅支持PDF文档上传,请你谅解!</p>-->
</el-form-item>
</el-form>
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="addFiles">确 定</el-button>
</el-dialog>
<el-dialog title="我的询价单" :visible.sync="showList" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column prop="name" label="联系人"/>
<el-table-column label="询价区域">
<template #default="{row}">
{{ row.province.name }}{{ row.city.name }}
</template>
</el-table-column>
<el-table-column prop="phone" label="联系方式"/>
<el-table-column prop="company" label="企业名称"/>
<el-table-column label="附件">
<template #default="{row}">
<file-type v-for="(item, index) in row.files" :key="index" :item="item"/>
</template>
</el-table-column>
<el-table-column prop="_add_time_str" label="询价日期"/>
</el-table>
<div class="mt-20 text-center">
<el-button @click="showList = false">关 闭</el-button>
</div>
</el-dialog>
</view>
</template>
<script>
import UGap from "@/uni_modules/vk-uview-ui/components/u-gap/u-gap.vue";
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import FileType from "../../../components/file-type/file-type.vue";
export default {
components: {UGap},
data() {
return {
dialogVisible: false,
address: [],
files: [],
list: [
{
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
{
image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
title: '身无彩凤双飞翼,心有灵犀一点通'
},
{
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
}
],
options: [],
companyList: []
};
},
onLoad(options) {
if (options && options.menu) {
this.currMenu = options.menu
}
this.getCompanyList()
this.options = provinces.map(item => {
item.children = [];
return item
})
this.options.forEach((province, index) => {
citys[index].forEach(city => {
this.options[index].children.push(city)
})
})
},
methods: {
menuSelect(e) {
this.currMenu = e
},
navTo(url) {
vk.navigateTo(url);
},
async getCompanyList() {
const {rows} = await vk.callFunction({
url: 'client/user/pub/getCompany',
data: {
isCoop: 1,
city: this.address.length > 0 ? [this.address[1]] : []
}
})
this.companyList = rows
},
async addFiles() {
await vk.callFunction({
url: 'client/selfSupport/kh/add',
data: {
files: this.files,
city: this.address.length > 0 ? this.address[1] : []
}
})
this.$message({
message: '下单成功',
type: 'success'
})
this.dialogVisible = false
}
components: {FileType, UGap},
data() {
return {
dialogVisible: false,
address: [],
files: [],
options: [],
companyList: [],
name: null,
phone: null,
company: null,
showList: false,
list: [],
allChildCate: [],
contactList: [],
showTips: false
};
},
onLoad(options) {
if (options && options.menu) {
this.currMenu = options.menu
}
this.getCategoryTreeData()
this.options = provinces.map(item => {
item.children = [];
return item
})
this.options.forEach((province, index) => {
citys[index].forEach(city => {
city.children = []
this.options[index].children.push(city)
})
})
this.options.forEach((province, index) => {
citys[index].forEach((city, cityIndex) => {
areas[index][cityIndex].forEach(area => {
this.options[index].children[cityIndex].children.push(area)
})
})
})
this.getContactList()
const user = vk.getVuex('$user.userInfo')
this.company = user.accountType === 2 ? user.company.companyName : user.person.personName
},
methods: {
getCategoryTreeData() {
vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...',
data: {},
success: (data) => {
this.allChildCate = []
data.rows.forEach(item => {
item.children.forEach(child => {
this.allChildCate.push(child)
})
})
this.getCompanyList()
}
});
},
menuSelect(e) {
this.currMenu = e
},
navTo(url) {
vk.navigateTo(url);
},
async getCompanyList() {
const {rows} = await vk.callFunction({
url: 'client/user/pub/getCompany',
data: {
isCoop: 1,
province: this.address.length > 0 ? [this.address[0]] : []
}
})
this.companyList = rows.map(item => {
item.name = item.company.companyName
item.mainSpotCategory = []
if (item.company && item.company.mainSpotCategoryIds) {
this.allChildCate.forEach(child => {
if (item.company.mainSpotCategoryIds.includes(child._id)) {
item.mainSpotCategory.push(child.name)
}
})
}
return item
})
},
async addFiles() {
if (!this.name) return this.$message({type: 'error', message: '请输入联系人'})
if (!this.phone) return this.$message({type: 'error', message: '请输入联系方式'})
if (!this.company) return this.$message({type: 'error', message: '请输入您的企业名称'})
if (this.files.length === 0) return this.$message({type: 'error', message: '请上传询价单附件'})
if (!vk.getVuex('$user.userInfo.fadadaConfirm') || [-1, 2].includes(vk.getVuex('$user.userInfo.authStatus'))) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
this.dialogVisible = false
return
}
let city, province
this.options.forEach((provinceItem, index) => {
provinceItem.children.forEach(cityItem => {
if (cityItem.code === this.address[1]) {
city = cityItem
province = {code: provinceItem.code, name: provinceItem.name}
}
})
})
await vk.callFunction({
url: 'client/selfSupport/kh/add',
data: {
files: this.files,
city,
province,
name: this.name,
phone: this.phone,
company: this.company,
}
})
await this.$alert('<p style="text-align: center">您已下单成功,感谢您选择金久信</p><p style="text-align: center">请待平台为您提供竭诚服务!</p><p style="text-align: center; color: red">客服电话:0771-3923001</p>', '', {
dangerouslyUseHTMLString: true,
})
this.dialogVisible = false
},
async getList() {
const {rows} = await vk.callFunction({
url: 'client/selfSupport/kh/getList',
})
this.list = rows
this.showList = true
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
},
navToContact() {
this.dialogVisible = false
this.showList = false
vk.navigateTo({url: '/pages/user/user?menu=business-contact'})
},
selectContact(name) {
const contact = this.contactList.find(item => item.name === name)
this.phone = contact.phone
},
previewUpload({url}) {
window.open(url)
}
}
}
</script>
<style lang="scss">
.w-1200 {
width: 1200px;
margin: 20px auto;
background-color: #fff;
width: 1200px;
margin: 20px auto;
background-color: #fff;
.test {
height: 50px;
color: #ffffff;
font-size: 18px;
background-color: #bf2b28;
display: flex;
align-items: center;
justify-content: center;
.test {
height: 50px;
color: #ffffff;
font-size: 18px;
background-color: #bf2b28;
display: flex;
align-items: center;
justify-content: center;
text {
margin: 0 20px;
}
text:hover {
color: #F2CFCE;
}
text {
padding: 0 20px;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.tool-bar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
font-size: 16px;
.search {
display: flex;
align-items: center;
}
text:hover {
background-color: #690503
}
.cooperate {
.title {
text-align: center;
color: #bf2b28;
font-size: 28px;
line-height: 3em;
}
.wrap {
flex-wrap: wrap;
}
.grid-content {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
flex-direction: column;
.comments {
line-height: 2em;
}
}
.bg-purple {
border-top: 1px solid #f3f3f3;
border-right: 1px solid #f3f3f3;
.image {
width: 140px;
}
}
.active {
background-color: #941411
}
}
.tool-bar {
display: flex;
justify-content: space-between;
align-items: flex-start;
padding: 20px;
font-size: 16px;
.search {
display: flex;
align-items: center;
}
}
.cooperate {
.title {
text-align: center;
color: #bf2b28;
font-size: 28px;
line-height: 3em;
}
.wrap {
flex-wrap: wrap;
}
.grid-content {
display: flex;
justify-content: center;
align-items: center;
padding: 10px;
flex-direction: column;
.comments {
line-height: 2em;
}
}
.bg-purple {
border-top: 1px solid #f3f3f3;
border-right: 1px solid #f3f3f3;
.image {
width: 140px;
}
}
}
}
.logo {
width: 80px;
height: 80px;
width: 80px;
height: 80px;
}
</style>
+3 -3
View File
@@ -244,15 +244,15 @@ export default {
data() {
return {
list: [{
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
image: '/static/images/swiper_5.png',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
{
image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
image: '/static/images/swiper_5.png',
title: '身无彩凤双飞翼,心有灵犀一点通'
},
{
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
image: '/static/images/swiper_5.png',
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
}
],
+50 -18
View File
@@ -9,11 +9,11 @@
<text class="font-bold text-40">
购物车(全部{{ list.length }})
</text>
<view class="flex justify-end items-center">
<text>已选商品(不含运费)</text>
<text class="text-main text-40 font-bold mx-20">¥{{ amount }}</text>
<el-button type="primary" round>结算</el-button>
</view>
<!-- <view class="flex justify-end items-center">-->
<!-- <text>已选商品(不含运费)</text>-->
<!-- <text class="text-main text-40 font-bold mx-20">¥{{ amount }}</text>-->
<!-- <el-button type="primary" round @click.native="addFromCart">结算</el-button>-->
<!-- </view>-->
</view>
<view class="py-20">
<el-row :gutter="10">
@@ -46,23 +46,24 @@
<view class="flex justify-start items-start">
<el-checkbox v-model="list[index].checked" @change="changeCheck($event, item._id)">
</el-checkbox>
<el-image :src="item.goods.cover" class="cover ml-20" fit="fit"/>
<el-image :src="item.goods.cover" class="cover ml-20" fit="fit"/>
<view class="flex flex-col justify-start items-start ml-20">
{{ item.goods.name }}
<text class="font-bold mb-15">{{ item.goods.name }}</text>
<text class="text-gray">{{ item.sku.label }}</text>
</view>
</view>
</el-col>
<el-col :span="3">
<text class="text-35 font-bold flex-1">¥{{ item.goods.amount }}</text>
<text class="text-35 font-bold flex-1">¥{{ item.sku.values }}</text>
</el-col>
<el-col :span="3">
<text class="text-35 font-bold flex-1">
<el-input-number v-model="list[index].num" @change="changeNum" :min="1" size="small"/>
<el-input-number v-model="list[index].num" @change="changeNum(index)" :min="1" size="small"/>
</text>
</el-col>
<el-col :span="3">
<text class="text-35 font-bold flex-1 text-main">¥{{
parseFloat(item.goods.amount) * item.num
parseFloat(item.sku.values) * item.num
}}
</text>
</el-col>
@@ -72,7 +73,7 @@
</el-row>
</view>
<view class="mt-20 flex justify-between items-center">
<el-button type="text">移出购物车</el-button>
<el-button type="text" @click.native="removeMulti" :disabled="selectedList.length === 0">移出购物车</el-button>
<view class="flex justify-end items-center">
<view>
<text>已选商品</text>
@@ -81,7 +82,7 @@
</view>
<text class="ml-35">合计(不含运费):</text>
<text class="mx-15 font-bold text-40 text-main">¥{{ amount }}</text>
<el-button type="primary" round :disabled="selectedList.length === 0">结算</el-button>
<el-button type="primary" round :disabled="selectedList.length === 0" @click.native="addFromCart">结算</el-button>
</view>
</view>
</view>
@@ -106,18 +107,27 @@ export default {
const {rows} = await vk.callFunction({
url: "client/cart/kh/getList"
})
this.selectedAll = false
this.list = rows.map(item => {
item.checked = false
return item
})
},
doSelectAll() {
this.selectedList = []
this.list.forEach((item, index) => {
this.list[index].checked = this.selectedAll
if (this.selectedAll) this.selectedList.push(item._id)
})
},
changeNum(e) {
console.log(e)
changeNum(index) {
vk.callFunction({
url: "client/cart/kh/changeNum",
data: {
id: this.list[index]._id,
num: this.list[index].num
}
})
},
changeCheck(e, id) {
const index = this.selectedList.indexOf(id)
@@ -126,15 +136,38 @@ export default {
this.selectedAll = this.selectedList.length === this.list.length
},
remove(index) {
this.list.splice(index, 1)
vk.callFunction({
url: "client/cart/kh/delete",
data: {
ids: [this.list[index]._id]
}
})
this.list.splice(index, 1)
},
async removeMulti() {
if (this.selectedList.length === 0) return
await vk.callFunction({
url: "client/cart/kh/delete",
data: {
ids: this.selectedList
}
})
this.selectedList = []
await this.getList()
},
async addFromCart(){
const {data} = await vk.callFunction({
url: "client/order/kh/addFromList",
data: {
type: 0,
ids: this.selectedList
}
})
this.selectedAll = false
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
}
},
onShow() {
this.getList()
@@ -143,8 +176,7 @@ export default {
amount() {
let tmpAmount = 0
this.list.forEach(item => {
console.log(item.checked)
if (item.checked) tmpAmount += parseFloat(item.goods.amount) * parseInt(item.num)
if (item.checked) tmpAmount += parseFloat(item.sku.values) * parseInt(item.num)
})
return tmpAmount
}
+210 -112
View File
@@ -1,142 +1,240 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<view class="page-nav">
<el-breadcrumb separator=">">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>
<navigator style="display: inline-block;" url="/pages/index/shop/shop">特产商城</navigator>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-main">{{ info.name }}</el-breadcrumb-item>
</el-breadcrumb>
</view>
<view class="bg-white p-40 flex justify-start items-start">
<el-carousel height="400px" class="album">
<el-carousel-item v-for="(item, index) in info.album" :key="index">
<image :src="item" class="album-item" mode="aspectFill"/>
</el-carousel-item>
</el-carousel>
<view class="ml-35 flex flex-col justify-start items-start flex-1">
<view class="font-bold text-40 mb-20">{{ info.name }}</view>
<view class="flex flex-col justify-start items-start flex-1">
<text>产品介绍:</text>
<view class="desc p-20 mt-20">{{ info.desc }}</view>
</view>
<view class="flex justify-between items-center w-100p mt-20">
<view class="flex justify-start items-center">
<text>零售价:</text>
<text class="font-bold text-main">¥{{ info.amount }}</text>
</view>
<view class="flex justify-end is-center">
<el-button type="danger" round class="add-to-cart-btn" @click.native="addToCart">加入购物车</el-button>
<el-button type="primary" round class="ml-35" @click.native="newOrder">立即购买</el-button>
</view>
</view>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a">
<view class="page-nav">
<el-breadcrumb separator=">">
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
<el-breadcrumb-item>
<navigator style="display: inline-block;" url="/pages/index/shop/shop">特产商城</navigator>
</el-breadcrumb-item>
<el-breadcrumb-item class="text-main">{{ info.name }}</el-breadcrumb-item>
</el-breadcrumb>
</view>
<view class="bg-white p-40 flex justify-start items-start">
<el-carousel height="500px" class="album">
<el-carousel-item v-for="(item, index) in info.album" :key="index">
<image :src="item" class="album-item" mode="aspectFill"/>
</el-carousel-item>
</el-carousel>
<view class="ml-35 flex flex-col justify-start items-start flex-1">
<view class="font-bold text-40 mb-20">{{ info.name }}</view>
<view class="flex flex-col justify-start items-start flex-1">
<text>产品介绍:</text>
<view class="desc p-20 mt-20">{{ info.desc }}</view>
</view>
<view class="flex flex-col items-start justify-start w-100p mt-20">
<view class="flex flex-col justify-start items-start flex-1 mr-25 w-100p">
<view class="flex justify-start items-center">
<text>零售价:</text>
<text class="font-bold text-main">¥{{ info.amount }}</text>
</view>
<view class="flex-1 w-100p" v-if="info.sku">
<view class="w-100p my-25 flex flex-1 justify-center items-center p-15">
<text class="flex-1 text-center">规格/分类/说明</text>
<text class="flex-1 text-center">数量</text>
<text class="flex-1 text-center">价格</text>
</view>
<view class="border my-25 flex justify-center items-center p-15 pointer sku"
v-for="(item, index) in info.sku" :key="index"
:class="[selectedSku === item._index ? 'sku-selected' : '']">
<el-image v-if="item.image" :src="item.image" style="width: 40px; height: 40px"
@click="selectedSku = item._index"/>
<text class="flex-1 text-center" @click="selectedSku = item._index">{{
item.label
}}
</text>
<view class="flex-1 flex justify-center items-center" style="z-index: 999">
<el-input-number v-model="info.sku[index].num" :min="1" size="small"/>
</view>
<text class="flex-1 text-center" @click="selectedSku = item._index">{{
item.values
}}元
</text>
</view>
</view>
</view>
<view class="mt-40">
<view class="intro-title">商品介绍</view>
<view class="intro bg-white" v-html="info.content"></view>
<view class="flex justify-center items-center w-100p mt-20">
<el-button type="danger" round
:class="selectedSku ? 'add-to-cart-btn' : 'add-to-cart-btn-disabled'"
@click.native="addToCart" :disabled="!selectedSku">
加入购物车
</el-button>
<el-button type="primary" round class="ml-35" @click.native="newOrder"
:disabled="!selectedSku">立即购买
</el-button>
</view>
<view class="mt-20 flex justify-start items-center">
<template v-if="info.express">
<transporter theme="outline" size="16" fill="#9b9b9b" strokeLinecap="square"/>
<text class="ml-10">快递:{{ info.express }}</text>
</template>
<text v-if="info.deliverDate" class="ml-35">{{ info.deliverDate }}</text>
<text v-if="info.expressAmount !== undefined && info.expressAmount !== null" class="ml-35">
运费:{{ info.expressAmount === 0 ? '免运费' : info.expressAmount }}
</text>
</view>
<view class="mt-20 flex justify-start items-center" v-if="info.ensureService">
<like theme="outline" size="16" fill="#9b9b9b" strokeLinecap="square"/>
<text class="ml-10">{{ info.ensureService }}</text>
</view>
</view>
</view>
<!-- 现货市场 end -->
<gap height="50"/>
<common-footer></common-footer>
<right-bar></right-bar>
</view>
<view class="mt-40" v-if="info.video">
<view class="intro-title">视频介绍</view>
<video :src="info.video" autoplay controls style="width: 100%; height: 800px"></video>
</view>
<view class="mt-40">
<view class="intro-title">商品介绍</view>
<view class="intro bg-white" v-html="info.content"></view>
</view>
</view>
<!-- 现货市场 end -->
<gap height="50"/>
<common-footer></common-footer>
<right-bar></right-bar>
</view>
</template>
<script>
import UGap from "@/uni_modules/vk-uview-ui/components/u-gap/u-gap.vue";
import {Transporter, Like} from '@icon-park/vue'
export default {
components: {UGap},
data() {
return {
id: null,
info: {
name: ''
}
};
},
onLoad(options) {
if (options && options.id) {
this.id = options.id;
this.getInfo(options.id)
}
},
methods: {
navTo(url) {
vk.navigateTo(url);
},
async getInfo(id) {
this.info = await vk.callFunction({
url: 'client/goods/list/pub/getDetail',
data: {id}
})
},
addToCart(){
vk.callFunction({
url: 'client/cart/kh/add',
data: {
goodsId: this.id,
},
success: (res) => {
this.$message({
type:'success',
message: '添加成功'
})
}
})
},
async newOrder(){
const {data} = await vk.callFunction({
url: 'client/order/kh/add',
data: {
goodsId: this.id,
num: 1,
type: 0
}
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
}
components: {UGap, Transporter, Like},
data() {
return {
id: null,
info: {
name: ''
},
num: 1,
selectedSku: null
};
},
onLoad(options) {
if (options && options.id) {
this.id = options.id;
this.getInfo(options.id)
}
},
methods: {
navTo(url) {
vk.navigateTo(url);
},
async getInfo(id) {
this.info = await vk.callFunction({
url: 'client/goods/list/pub/getDetail',
data: {id}
})
if (this.info.sku && this.info.sku.length > 0) {
this.info.sku.map((sku, index) => {
this.$set(this.info.sku[index], 'num', 1)
return sku
})
this.selectedSku = this.info.sku[0]._index
}
},
addToCart() {
if (!vk.getVuex('$user.userInfo.fadadaConfirm') || ([-1, 2].includes(vk.getVuex('$user.userInfo.authStatus')) && !vk.getVuex('$user.userInfo.userType'))) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
return
}
vk.callFunction({
url: 'client/cart/kh/add',
data: {
goodsId: this.id,
skuId: this.selectedSku,
num: this.info.sku.find(item => item._index === this.selectedSku).num,
},
success: (res) => {
this.$message({
type: 'success',
message: '添加成功'
})
}
})
},
async newOrder() {
if (!vk.getVuex('$user.userInfo.fadadaConfirm') || ([-1, 2].includes(vk.getVuex('$user.userInfo.authStatus')) && !vk.getVuex('$user.userInfo.userType'))) {
this.$confirm('您尚未认证, 是否前往个人中心认证?', '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
}).then(() => {
vk.navigateTo({url: '/pages/user/user?menu=fadada'});
})
return
}
const {data} = await vk.callFunction({
url: 'client/order/kh/add',
title: '请求中...',
data: {
goodsId: this.id,
skuId: this.selectedSku,
num: this.info.sku.find(item => item._index === this.selectedSku).num,
type: 0
}
})
vk.navigateTo({
url: `/pages/index/shop/pay?id=${data}`
})
},
}
}
</script>
<style lang="scss" scoped>
.album {
width: 500px;
width: 500px;
.album-item {
width: 500px;
height: 400px;
}
.album-item {
width: 500px;
height: 400px;
}
}
.desc {
background-color: #F5E2E3;
background-color: #F5E2E3;
}
.add-to-cart-btn{
background-color: #FF7300;
.add-to-cart-btn {
background-color: #FF7300;
}
.intro-title{
background-color: #EF0021;
padding: 10px 20px;
color: white;
width: 120px;
text-align: center;
.add-to-cart-btn-disabled {
background-color: #f6aa6b;
}
.intro{
border-top: 1px solid #F95F6E;
.intro-title {
background-color: #EF0021;
padding: 10px 20px;
color: white;
width: 120px;
text-align: center;
}
.intro {
border-top: 1px solid #F95F6E;
}
.sku:hover {
background-color: #F5E2E3;
border: 1px solid #EF0021;
}
.sku-selected {
background-color: #F5E2E3;
border: 1px solid #EF0021;
}
</style>
+519 -198
View File
@@ -1,97 +1,202 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200 m-a bg-white p-40">
<template v-if="info">
<view class="pb-20 border-bottom flex justify-between items-center">
<text>订单号: {{ info.orderNo }}</text>
<text>下单时间: {{ info._add_time_str }}</text>
</view>
<view class="my-20">
<text class="font-bold text-35">商品详情</text>
<view class="flex justify-start items-start my-20">
<text class="w-15p" v-if="info.type === 0">封面</text>
<text class="w-40p">名称</text>
<text class="w-15p">数量</text>
<text class="w-15p">单价</text>
<text class="w-15p">小计</text>
</view>
<view class="flex justify-start items-start my-20" v-for="(item, index) in info.goods" :key="index">
<text class="w-15p" v-if="info.type === 0">
<image :src="item.goodsCover" mode="aspectFit" class="goods-cover"/>
</text>
<text class="w-40p font-bold text-35">{{ item.goodsName }}</text>
<text class="w-15p">x{{ item.num }}</text>
<text class="w-15p text-main">¥{{ item.goodsPrice }}</text>
<text class="w-15p">{{ item.goodsPrice * item.num }}</text>
</view>
</view>
</template>
<template v-if="info.type === 0">
<el-row :gutter="10" class="mb-20">
<el-col :span="4">
<el-input v-model="name" placeholder="请输入收件人姓名"/>
</el-col>
<el-col :span="4">
<el-input v-model="phone" placeholder="请输入收件人手机号"/>
</el-col>
</el-row>
<el-row :gutter="10" class="border-bottom pb-20">
<el-col :span="4">
<el-select v-model="addressIndex[0]" placeholder="请选择省">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[1]" placeholder="请选择市"
:disabled="addressIndex.length === 0">
<template v-if="addressIndex[0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[0]]" :key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="4">
<el-select v-model="addressIndex[2]" placeholder="请选择区"
:disabled="addressIndex.length === 1">
<template v-if="addressIndex[0] !== null && addressIndex[1] !== null">
<el-option v-for="(item, index) in areaData[addressIndex[0]][addressIndex[1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="12">
<el-input v-model="addressDetail" placeholder="请输入详细地址"/>
</el-col>
</el-row>
</template>
<view class="mt-20 w-50p flex flex-col justify-center items-center m-a">
<text class="text-main font-bold text-40 mb-20" v-if="info">订单金额:¥{{ info.amount }}</text>
<el-button type="primary" round
:disabled="(info.type === 0 && (!phone || !name || addressIndex.length < 3))" @click="onPay">
立即支付
</el-button>
</view>
<div class="pay-price" v-if="billQRCode">
<uv-qrcode ref="qrcode" size="240px" :value="billQRCode"></uv-qrcode>
<div class="pay-desc">请打开手机微信,扫一扫完成支付</div>
<el-button type="success" @click="onPayStatus">已完成支付</el-button>
</div>
<view>
<top-bar></top-bar>
<!-- <common-header></common-header>-->
<!-- <category-bar></category-bar>-->
<view class="w-1200 m-a bg-white p-40 mt-20">
<template v-if="info">
<view class="pb-20 border-bottom flex justify-between items-center">
<text>订单号: {{ info.orderNo }}</text>
<text>下单时间: {{ info._add_time_str }}</text>
</view>
<gap height="50"/>
<common-footer></common-footer>
<right-bar></right-bar>
<view class="my-20">
<text class="font-bold text-35">商品详情</text>
<view class="flex justify-start items-start my-20">
<text class="w-15p" v-if="info.type === 0">封面</text>
<text class="w-40p">商品详情</text>
<text class="w-15p">数量</text>
<text class="w-15p">单价</text>
<text class="w-15p">小计</text>
</view>
<view class="flex justify-start items-start my-20" v-for="(item, index) in info.goods" :key="index">
<text class="w-15p" v-if="info.type === 0">
<image :src="item.goodsCover" mode="aspectFit" class="goods-cover"/>
</text>
<template v-if="info.type === 0">
<view class="flex flex-col justify-start items-start w-40p">
<text class=" font-bold text-35">{{ item.goodsName }}</text>
<text class="mt-15 text-gray">{{ item.sku.label }}</text>
</view>
<text class="w-15p">x{{ item.num }}</text>
<text class="w-15p text-main">¥{{ item.sku.values }}</text>
<text class="w-15p font-bold">¥{{ item.sku.values * item.num }}</text>
</template>
<template v-else>
<view class="flex flex-col justify-start items-start w-40p">
<text class=" font-bold text-35">{{ item.goodsName }}</text>
</view>
<text class="w-15p">x{{ item.num }}</text>
<text class="w-15p text-main">¥{{ item.goodsPrice }}</text>
<text class="w-15p font-bold">¥{{ item.goodsPrice * item.num }}</text>
</template>
</view>
</view>
</template>
<template v-if="info.type === 0">
<div class="p-20 rounded border m-30 pointer address" v-if="!address" @click="showAddress">
点击选择地址
</div>
<div v-else
class="py-20 flex justify-between items-center">
<div class="flex flex-col justify-start items-start">
<div class="flex justify-start items-center">
<text class="font-bold">{{ address.name }}</text>
</div>
<text>{{ address.phone }}</text>
<text v-if="address.addressRegion && address.addressRegion.province">{{
address.addressRegion.province.name
}}{{
address.addressRegion.city.name
}}{{ address.addressRegion.area.name }}{{ address.addressDetail }}
</text>
<text v-else-if="info.address.province">{{ info.address.province.name }}{{
info.address.city.name
}}{{ info.address.area.name }}{{ info.addressDetail }}
</text>
</div>
<div class="flex justify-center items-center">
<el-button type="primary" @click="showAddress">
变更
</el-button>
</div>
</div>
</template>
<!-- <view class="mt-40 font-bold text-main">您的会员等级:-->
<!-- {{ getUserLevelLabel(vk.getVuex('$user.userInfo.userLevel')) }}-->
<!-- {{ info.offRate !== 100 ? `,享受${info.offRate / 10}折优惠,已为您优惠${info.saveAmount}元` : '' }}-->
<!-- </view>-->
<div v-if="info.type === 0" class="my-20">
<p>备注和要求:</p>
<el-input v-model="remark" type="textarea"/>
</div>
<view class="mt-40 w-50p flex flex-col justify-center items-center m-a">
<text class=" mb-20"
:class="[info.amount !== info.offAmount ? 'text-line-through text-30' : 'text-main font-bold text-40']"
v-if="info">
订单金额:¥{{ info.amount }}
</text>
<text class="text-main font-bold text-40 mb-20" v-if="info && info.amount !== info.offAmount">
优惠后金额:¥{{ parseFloat(info.offAmount).toFixed(2) }}
</text>
<el-button type="primary" round
:disabled="(info.type === 0 && !address)" @click="onPay">
立即支付
</el-button>
</view>
<div class="pay-price" v-if="billQRCode">
<uv-qrcode ref="qrcode" size="240px" :value="billQRCode"></uv-qrcode>
<div class="pay-desc">微信、支付宝、云闪付扫码完成支付</div>
<el-button type="success" @click="onPayStatus">已完成支付</el-button>
</div>
</view>
<gap height="50"/>
<common-footer></common-footer>
<right-bar></right-bar>
<el-dialog :visible.sync="dialogVisible" :title="dialogTitle" width="50%" :close-on-click-modal="false"
@close="dialogVisible = false">
<template v-if="dialogVisible && dialogType === 'address-list'">
<div v-for="(item, index) in addressList" :key="index"
class="py-20 border-bottom flex justify-between items-center">
<div class="flex flex-col justify-start items-start">
<div class="flex justify-start items-center">
<text v-if="item.isDefault" class="default-address">默</text>
<text class="font-bold">{{ item.name }}</text>
</div>
<text>{{ item.phone }}</text>
<text>{{ item.addressRegion.province.name }}{{
item.addressRegion.city.name
}}{{ item.addressRegion.area.name }}{{ item.addressDetail }}
</text>
</div>
<div class="flex justify-center items-center">
<el-button type="primary" @click="address = item; dialogVisible = false" size="small">
选择
</el-button>
<el-button type="warning" @click="addressEdit(item)" plain size="small" class="mt-20">
编辑
</el-button>
</div>
</div>
<div class="text-center">
<el-button plain @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="dialogType = 'address-action'; dialogTitle = '新增地址'">
新增地址
</el-button>
</div>
</template>
<div class="flex flex-col justify-start" v-else-if="dialogVisible && dialogType === 'address-action'">
<el-form ref="form" label-width="100px">
<el-row :gutter="10" class="mb-20">
<el-col :span="12">
<el-form-item label="收件人姓名">
<el-input v-model="name" placeholder="请输入收件人姓名"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="收件人手机号">
<el-input v-model="phone" placeholder="请输入收件人手机号"/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="收件人地址">
<el-row :gutter="10">
<el-col :span="6">
<el-select v-model="addressIndex[0]" placeholder="请选择省" class="w-100p">
<el-option v-for="(item, index) in provinceData" :key="index"
:label="item.name"
:value="index">
</el-option>
</el-select>
</el-col>
<el-col :span="6">
<el-select v-model="addressIndex[1]" placeholder="请选择市" class="w-100p"
:disabled="addressIndex.length === 0">
<template v-if="addressIndex[0] !== null">
<el-option v-for="(item, index) in cityData[addressIndex[0]]" :key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
<el-col :span="6">
<el-select v-model="addressIndex[2]" placeholder="请选择区" class="w-100p"
:disabled="addressIndex.length === 1">
<template v-if="addressIndex[0] !== null && addressIndex[1] !== null">
<el-option v-for="(item, index) in areaData[addressIndex[0]][addressIndex[1]]"
:key="index"
:label="item.name"
:value="index">
</el-option>
</template>
</el-select>
</el-col>
</el-row>
</el-form-item>
<el-form-item label="详细地址">
<el-input v-model="addressDetail" placeholder="请输入详细地址"/>
</el-form-item>
<el-form-item label="默认地址">
<el-switch v-model="isDefault"/>
</el-form-item>
</el-form>
<div class="flex justify-center items-center">
<el-button type="primary" @click="onAddressAction">保存</el-button>
<el-button @click="dialogTitle = '地址列表'; dialogType = 'address-list'">取消</el-button>
</div>
</div>
</el-dialog>
</view>
</template>
<script>
@@ -99,131 +204,347 @@ import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import dayjs from "dayjs";
import {Loading} from "element-ui";
import {getUserLevelLabel} from "../../../util";
const OpenSdk = require('../../user/lib/base').default;
const sdk = new OpenSdk({
appId: '10037e6f6823b20801682b6a5e5a0006',
appKey: '1c4e3b16066244ae9b236a09e5b312e8'
// appId: '10037e6f6823b20801682b6a5e5a0006',
// appKey: '1c4e3b16066244ae9b236a09e5b312e8'
// 正式
appId: '8a81c1db8fc5238d01910b9e312d0692',
appKey: 'a15ceac60f5b464eb758c4fe7800ee9f'
// 测试分账
// appId: 'f0ec96ad2c3848b5b810e7aadf369e2f',
// appKey: '775481e2556e4564985f5439a5e6a277'
})
// const mid = '8984501521190CF'
// const tid = '20713432'
const mid = '898450100002303'
const tid = 'G5SBN2XJ'
// const mid = '898310060514001'
// const tid = '00000001'
export default {
name: "order",
data() {
return {
id: null,
info: {
type: null
},
provinceData: provinces,
cityData: citys,
areaData: areas,
addressIndex: [null, null, null],
addressDetail: '',
name: '',
phone: '',
billQRCode: null,
checkPayInterval: null,
}
},
methods: {
async getInfo() {
this.info = await vk.callFunction({
url: 'client/order/kh/getInfo',
data: {
id: this.id
}
})
if (this.info.orderStatus === 1) {
this.$message({
type: 'success',
message: '订单已支付成功'
})
setTimeout(() => {
this.$router.push({
path: '/pages/user/order',
})
}, 1000)
}
},
async onPay() {
if (this.info.type === 0) {
if (this.addressIndex.length > 2 && this.addressIndex[2] === null) {
await vk.callFunction({
url: 'client/order/kh/updateAddress',
data: {
id: this.id,
address: [provinces[this.addressIndex[0]], citys[this.addressIndex[0]][this.addressIndex[1]], areas[this.addressIndex[0]][this.addressIndex[1]][this.addressIndex[2]]],
addressDetail: this.addressDetail,
phone: this.phone,
name: this.name,
}
})
}
}
const requestTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss')
const timestamp = dayjs().format('YYYYMMDDHHmmss')
const goods = []
let goodsName = this.info.goods[0].goodsName
goods.push({goodsName})
if (this.info.goods.length > 1) goodsName += `等${this.info.goods.length - 1}件商品`
let data = {
queryUrl: 'https://test-api-open.chinaums.com/v1/netpay/bills/get-qrcode',
timestamp,
nonce: 'rp84ufhfn20yneo3tp',
content: {
billNo: this.info.orderNo,
requestTimestamp,
mid: '898201612345678',
tid: '88880001',
instMid: 'QRPAYDEFAULT',
totalAmount: 1,
notifyUrl: 'https://fc-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/pay_notify',
goods
}
}
/**
* 调用函数
*/
sdk.exec(data).then(res => {
const h = this.$createElement;
const result = JSON.parse(res);
if (result.errCode === 'SUCCESS') {
this.showQrcode = true
this.billQRCode = result.billQRCode
setTimeout(() => {
this.checkPayInterval = setInterval(() => {
this.getInfo()
}, 1000)
}, 3000)
}
})
},
},
onLoad(options) {
if (options && options.id) {
this.id = options.id
this.getInfo()
}
},
onUnload() {
if (this.checkPayInterval) clearInterval(this.checkPayInterval)
name: "order",
data() {
return {
id: null,
info: {
type: null,
offRate: 100
},
provinceData: provinces,
cityData: citys,
areaData: areas,
addressIndex: [null, null, null],
addressDetail: '',
name: '',
phone: '',
billQRCode: null,
checkPayInterval: null,
dialogVisible: false,
dialogTitle: '',
dialogType: '',
address: null,
addressList: [],
selectedAddressId: null,
isDefault: false,
remark: ''
}
},
methods: {
getUserLevelLabel,
async getInfo(resetOrderNo = false) {
this.info = await vk.callFunction({
url: 'client/order/kh/getInfo',
data: {
id: this.id,
resetOrderNo
}
})
if (this.info.name) {
this.address = {
name: this.info.name,
phone: this.info.phone,
addressDetail: this.info.addressDetail,
addressRegion: {
province: this.info.address.province,
city: this.info.address.city,
area: this.info.address.area,
},
}
}
if (this.info.orderStatus === -1) {
this.$message.error('订单已取消')
if (this.checkPayInterval) clearInterval(this.checkPayInterval)
vk.redirectTo({
url: '/pages/order/order?menuIndex=1',
})
}
if ([1, 4].includes(this.info.orderStatus)) {
if (this.checkPayInterval) clearInterval(this.checkPayInterval)
this.$message({
type: 'success',
message: '订单已支付成功'
})
setTimeout(() => {
if ([7, 11].includes(this.info.type)) {
vk.navigateBack()
} else if (this.info.type === 13) {
vk.redirectTo({
url: '/pages/contract/index?tab=sign',
})
} else if (this.info.type === 10) {
vk.redirectTo({
url: '/pages/index/old/release',
})
} else {
vk.redirectTo({
url: '/pages/order/order?menuIndex=1',
})
}
}, 1000)
}
},
async onPay() {
if (this.info.type === 0) {
if (!this.address) return this.$message({type: 'error', message: '请选择地址'})
await vk.callFunction({
url: 'client/order/kh/updateAddress',
data: {
id: this.id,
address: {
province: this.address.addressRegion.province,
city: this.address.addressRegion.city,
area: this.address.addressRegion.area,
},
addressDetail: this.address.addressDetail,
phone: this.address.phone,
name: this.address.name,
remark: this.remark,
}
})
}
// await vk.callFunction({
// url: 'client/user/pub/pay',
// data: {
// orderNo: this.info.orderNo,
// billStatus: 'PAID',
// billPayment: JSON.stringify({
// payTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
// receiptAmount: this.info.offAmount * 100,
// paySeqId: 'asdasd'
// })
// }
// })
// this.checkPayInterval = setInterval(() => {
// this.getInfo()
// }, 1000)
// return
const requestTimestamp = dayjs().format('YYYY-MM-DD HH:mm:ss')
const timestamp = dayjs().format('YYYYMMDDHHmmss')
// 平台分账金额
let platformAmount = 0
const goodsList = []
// let goodsName = this.info.goods[0].goodsName
// goods.push({goodsName})
// if (this.info.goods.length > 1) goodsName += `等${this.info.goods.length - 1}件商品`
let subOrderAmount = 0
this.info.goods.forEach((goods, index) => {
const goodsData = {
goodsName: goods.goodsName
}
if (goods.company && goods.company.merchantCode && goods.company.settleRate) {
// subOrderAmount += parseInt((goods.company.settleRate * goods.price).toString())
// goodsData['subOrderAmount'] = parseInt((goods.company.settleRate * goods.price).toString())
subOrderAmount += 9
goodsData['subOrderAmount'] = 9
goodsData['subMerchantId'] = goods.company.merchantCode
goodsData['merOrderId'] = this.info.orderNo + index
}
goodsList.push(goodsData)
})
if (subOrderAmount > 0) platformAmount = this.info.offAmount * 100 - subOrderAmount
// let data = {
// queryUrl: 'https://test-api-open.chinaums.com/v1/inip/upsp/shop/csb/get-qrcode',
// sysSource: 'OPT',
// vaMchntNo: mid,
// vaTermNo: tid,
// timestamp,
// nonce: 'rp84ufhfn20yneo3tp',
// billNo: this.info.orderNo,
// totalAmount: 10,
// notifyUrl: 'https://www.jinjiuxinzg.cn/pay_notify',
// vaFld:
// }
let attachedData = this.info.goods[0].goodsName
if (this.info.goods.length > 1) attachedData += `等${this.info.goods.length - 1}件商品`
let data = {
queryUrl: 'https://api-mop.chinaums.com/v1/netpay/bills/get-qrcode',
timestamp,
nonce: 'rp84ufhfn20yneo3tp',
content: {
billNo: this.info.orderNo,
requestTimestamp,
mid,
tid,
instMid: 'QRPAYDEFAULT',
totalAmount: parseInt(this.info.offAmount * 100).toFixed(0),
notifyUrl: 'https://tcb-n44byxi8bmrfrki-d4bn1c4a206d.service.tcloudbase.com/pay_notify',
// notifyUrl: 'https://www.jinjiuxinzg.cn/pay_notify',
goods: goodsList,
attachedData,
billDesc: attachedData,
}
}
if (platformAmount > 0) {
data['divisionFlag'] = true
data['platformAmount'] = platformAmount
}
console.log(data)
/**
* 调用函数
*/
const loadingInstance = Loading.service({fullscreen: true, text: '请求中'});
sdk.exec(data).then(res => {
this.$nextTick(() => {
loadingInstance.close();
});
const h = this.$createElement;
const result = JSON.parse(res);
if (result.errCode === 'SUCCESS') {
this.showQrcode = true
this.billQRCode = result.billQRCode
setTimeout(() => {
this.checkPayInterval = setInterval(() => {
this.getInfo()
}, 1000)
}, 3000)
}
}).catch(err => {
this.$nextTick(() => {
loadingInstance.close();
});
this.$message({
type: 'error',
message: '服务器繁忙,请稍后再试或联系平台客服'
})
setTimeout(() => {
vk.redirectTo({
url: '/pages/order/order?activeName=0&menuIndex=1',
})
}, 1500)
})
},
async onAddressAction() {
if (!this.name) return this.$message({type: 'error', message: '请填写收件人姓名'})
if (!this.phone) return this.$message({type: 'error', message: '请填写收件人手机号'})
if (!this.addressDetail || this.addressIndex[2] === null) return this.$message({
type: 'error',
message: '请填写地址'
})
const province = this.provinceData[this.addressIndex[0]]
const city = this.cityData[this.addressIndex[0]][this.addressIndex[1]]
const area = this.areaData[this.addressIndex[0]][this.addressIndex[1]][this.addressIndex[2]]
this.addressRegion = {
province: {code: province.code, name: province.name},
city: {code: city.code, name: city.name},
area: {code: area.code, name: area.name},
}
await vk.callFunction({
url: 'client/userAddress/kh/addUpdate',
data: {
id: this.selectedAddressId ?? null,
name: this.name,
phone: this.phone,
addressDetail: this.addressDetail,
addressRegion: this.addressRegion,
isDefault: this.isDefault
}
})
this.name = ''
this.phone = ''
this.addressDetail = ''
this.addressIndex = [null, null, null,]
this.dialogType = 'address-list'
this.dialogTitle = '地址列表'
await this.getUserAddress()
},
async getUserAddress() {
const {rows} = await vk.callFunction({
url: 'client/userAddress/kh/getList'
})
this.addressList = rows
},
showAddress() {
this.dialogType = 'address-list'
this.dialogTitle = '选择地址'
this.dialogVisible = true
},
addressEdit(item) {
this.selectedAddressId = item._id
this.name = item.name
this.phone = item.phone
this.addressDetail = item.addressDetail
this.addressIndex[0] = this.provinceData.findIndex(i => i.code === item.addressRegion.province.code)
this.addressIndex[1] = this.cityData[this.addressIndex[0]].findIndex(i => i.code === item.addressRegion.city.code)
this.addressIndex[2] = this.areaData[this.addressIndex[0]][this.addressIndex[1]].findIndex(i => i.code === item.addressRegion.area.code)
this.dialogType = 'address-action';
this.dialogTitle = ' 编辑地址'
}
},
onLoad(options) {
if (options && options.id) {
this.id = options.id
this.getInfo(true)
this.getUserAddress()
}
},
beforeDestroy() {
if (this.checkPayInterval) clearInterval(this.checkPayInterval)
},
onUnload() {
if (this.checkPayInterval) clearInterval(this.checkPayInterval)
}
}
</script>
<style lang="scss" scoped>
.goods-cover {
width: 100px;
height: 100px;
width: 100px;
height: 100px;
}
.pay-price {
margin-top: 20px;
margin-top: 20px;
}
.pay-desc {
font-size: 16px;
line-height: 2em;
font-size: 16px;
line-height: 2em;
}
.address:hover {
border: 1px solid #a92924;
background-color: #f1c7c7;
}
.default-address {
background-color: #a92924;
color: #fff;
font-size: 14px;
width: 20px;
height: 20px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 5px;
padding: 2px;
}
</style>
+294 -208
View File
@@ -1,63 +1,89 @@
<template>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200">
<u-swiper :list="list" :height="380" borderRadius="0"></u-swiper>
<view class="tool-bar">
<view class="search">
<text>地区:</text>
<el-cascader :options="options" :props="{label: 'name', value: 'code'}" v-model="address"
@change="getGoodsList()" clearable/>
</view>
<view class="buy-btn">
<image src="https://oss.wsdns.cn/20231204/bcc976f4396e437abf19deb11c1f06b4.png" mode="widthFix"/>
</view>
</view>
<view class="tool-bar">
<view class="item">分类:</view>
<view class="item" @click="selectCate(null)">全部</view>
<view class="item" v-for="(item, index) in categoryList" :key="index"
@click="selectCate(item._id)"
:class="[categoryId === item._id? 'active' : '']">{{ item.name }}
</view>
</view>
<view>
<top-bar></top-bar>
<common-header></common-header>
<category-bar></category-bar>
<view class="w-1200">
<common-swiper page="shop"/>
<view class="tool-bar">
<view class="search">
<el-row :gutter="10" flex justify="center" align="center">
<el-col :span="8">
<el-input v-model="keyword" placeholder="请输入商品名称" clearable @clear="getGoodsList()"
@keyup.enter.native="getGoodsList()" class="w-100"/>
</el-col>
<el-col :span="10">
<view class="flex justify-start items-center">
<text class="text-25">特产地区:</text>
<el-cascader :options="options" :props="{label: 'name', value: 'code'}"
v-model="address"
@change="getGoodsList()" clearable/>
</view>
</el-col>
<el-col :span="6">
<image src="https://oss.wsdns.cn/20231204/bcc976f4396e437abf19deb11c1f06b4.png"
mode="widthFix"/>
</el-col>
</el-row>
</view>
<view class="goods-list">
<view class="flex flex-wrap justify-start is-status">
<view class="w-20p" v-for="(item, index) in goodsList" :key="index">
<view class="p-20">
<view class="grid-content bg-purple pointer"
@click="navTo(`/pages/index/shop/detail?id=${item._id}`)">
<image :src="item.cover" mode="aspectFill"/>
<view class="comments">
<view class="goods-name">
{{ item.name }}
</view>
<view class="goods-price">¥{{ item.amount }}</view>
</view>
</view>
</view>
</view>
</view>
<div class="pagination">
<el-pagination
background
layout="prev, pager, next"
:total="total"
:page-size="pageSize"
@click="getGoodsList"
>
</el-pagination>
</div>
</view>
<view class="tool-bar">
<view class="item">分类:</view>
<view class="item" @click="selectCate(null)">全部</view>
<view class="item" v-for="(item, index) in categoryList" :key="index"
@click="selectCate(item._id)"
:class="[categoryId === item._id? 'active' : '']">{{ item.name }}
</view>
<!-- 现货市场 end -->
<gap height="50"/>
<right-bar></right-bar>
<common-footer></common-footer>
</view>
</view>
<div class="m-a w-1200 flex justify-start items-center flex-wrap" v-if="adLoaded">
<div v-for="(ad, adIndex) in adList" :key="adIndex"
:style="{width: '600px'}">
<template v-if="ad.length > 0">
<el-carousel :height="`100px`" class="m-a">
<el-carousel-item v-for="(item, index) in ad" :key="index" :style="{width: '600px'}">
<image @click="vk.navigateTo(`/pages/yellowPage/info?id=${item.companyId}`)"
class="pointer" :src="item.swiper" mode="aspectFill"
:style="{width: '100%', height: '100px'}"/>
</el-carousel-item>
</el-carousel>
</template>
</div>
</div>
<view class="goods-list">
<view class="flex flex-wrap justify-start is-status">
<view class="w-20p " v-for="(item, index) in goodsList" :key="index">
<view class="p-20 ">
<view class="grid-content bg-purple pointer pos-r"
@click="navTo(`/pages/index/shop/detail?id=${item._id}`)">
<text class="recommend" v-if="item.recommend === 1">荐</text>
<image :src="item.cover" mode="aspectFill"/>
<view class="comments">
<view class="goods-name" style="height: 60px">
{{ item.name }}
</view>
<view class="goods-price">¥{{ item.amount }}</view>
</view>
</view>
</view>
</view>
</view>
<div class="pagination">
<el-pagination
background
layout="prev, pager, next"
:total="total"
:page-size="pageSize"
@click="getGoodsList"
>
</el-pagination>
</div>
</view>
<!-- 现货市场 end -->
<gap height="50"/>
<right-bar></right-bar>
<common-footer></common-footer>
</view>
</template>
<script>
@@ -66,184 +92,244 @@ import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
export default {
components: {UGap},
data() {
return {
categoryList: [],
goodsList: [],
list: [
{
image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
title: '昨夜星辰昨夜风,画楼西畔桂堂东'
},
{
image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
title: '身无彩凤双飞翼,心有灵犀一点通'
},
{
image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
}
],
options: [],
address: [],
pageIndex: 1,
pageSize: 20,
total: 0,
categoryId: null
};
},
onLoad(options) {
if (options && options.menu) {
this.currMenu = options.menu
}
this.options = provinces.map(item => {
item.children = [];
return item
})
this.options.forEach((province, index) => {
citys[index].forEach(city => {
this.options[index].children.push(city)
})
})
this.getCategoryList()
this.getGoodsList()
},
methods: {
menuSelect(e) {
this.currMenu = e
},
navTo(url) {
vk.navigateTo(url);
},
getCategoryList() {
vk.callFunction({
url: 'client/goods/category/pub/getList'
}).then(res => {
this.categoryList = res.rows
})
},
getGoodsList(pageIndex = 1) {
vk.callFunction({
url: 'client/goods/list/pub/getList',
data: {
pageIndex,
pageSize: this.pageSize,
city: this.address.length > 1 ? this.address[1] : null,
parentId: this.categoryId
}
}).then(res => {
this.goodsList = res.rows
})
},
selectCate(cateId) {
if (this.categoryId === cateId) this.categoryId = null
else this.categoryId = cateId
this.getGoodsList()
}
components: {UGap},
data() {
return {
categoryList: [],
goodsList: [],
options: [],
address: [],
pageIndex: 1,
pageSize: 20,
total: 0,
categoryId: null,
keyword: null,
adList: [],
adNum: 0,
adLoaded: false
};
},
async onLoad(options) {
await this.getCategoryList()
if (options && options.menu) this.currMenu = options.menu
if (options && options.keyword) this.keyword = options.keyword
if (options && options.cateName) {
const cate = this.categoryList.find(item => item.name === options.cateName)
if (cate) this.categoryId = cate._id
}
this.options = provinces.map(item => {
item.children = [];
return item
})
this.options.forEach((province, index) => {
citys[index].forEach(city => {
this.options[index].children.push(city)
})
})
console.error(this.options)
this.getGoodsList()
},
methods: {
menuSelect(e) {
this.currMenu = e
},
navTo(url) {
vk.navigateTo(url);
},
async getCategoryList() {
const res = await vk.callFunction({
url: 'client/goods/category/pub/getList'
})
this.categoryList = res.rows
},
getGoodsList(pageIndex = 1) {
vk.callFunction({
url: 'client/goods/list/pub/getList',
data: {
pageIndex,
pageSize: this.pageSize,
city: this.address.length > 1 ? this.address[1] : null,
parentId: this.categoryId,
keyword: this.keyword
}
}).then(res => {
this.goodsList = res.rows
this.getAdList()
})
},
selectCate(cateId) {
if (this.categoryId === cateId) this.categoryId = null
else this.categoryId = cateId
this.getGoodsList()
},
async getAdList() {
this.adList = [[], [], [], [], []]
if (this.address.length === 0) {
if (!this.categoryId) {
for (let i = 0; i < 5; i++) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 27 + i
}
})
if (res.data) this.adList[i] = res.data
}
} else {
const cate = this.categoryList.find(item => item._id === this.categoryId)
if (cate.ad && cate.ad.length > 0) {
cate.ad.forEach(item => {
this.adList[item.adKey - 27].push(item)
})
}
}
} else {
for (let i = 0; i < 5; i++) {
const res = await vk.callFunction({
url: 'client/ad/pub/getList',
data: {
adKey: 27 + i,
region: this.address[0]
}
})
if (res.data) this.adList[i] = res.data
// rows.forEach(item => {
// if (item.businessCard.album && item.businessCard.album.length > 0) {
// this.adList[i].push({
// swiper: Array.isArray(item.businessCard.album) ? item.businessCard.album[0] : item.businessCard.album,
// companyId: item._id
// })
// }
// })
}
}
this.adNum = 0
for (let i = 0; i < 5; i++) {
if (this.adList[i].length > 0) {
this.adNum += 1
}
}
this.adLoaded = true
this.$forceUpdate()
},
}
}
</script>
<style lang="scss">
.w-1200 {
width: 1200px;
margin: 20px auto;
background-color: #fff;
width: 1200px;
margin: 20px auto;
background-color: #fff;
.test {
height: 50px;
color: #ffffff;
font-size: 18px;
background-color: #bf2b28;
display: flex;
align-items: center;
justify-content: center;
.test {
height: 50px;
color: #ffffff;
font-size: 18px;
background-color: #bf2b28;
display: flex;
align-items: center;
justify-content: center;
text {
margin: 0 20px;
}
text {
margin: 0 20px;
}
}
.tool-bar {
display: flex;
justify-content: flex-start;
align-items: center;
padding: 20px;
font-size: 16px;
.search {
display: flex;
align-items: center;
}
.tool-bar {
display: flex;
justify-content: flex-start;
align-items: center;
padding: 20px;
font-size: 16px;
.search {
display: flex;
align-items: center;
}
.item {
margin-right: 10px;
cursor: pointer;
}
.item:hover, .active {
color: #bf2b28;
}
.item {
margin-right: 10px;
cursor: pointer;
}
.item:hover, .active {
color: #bf2b28;
}
}
}
.wrap {
flex-wrap: wrap;
flex-wrap: wrap;
}
.goods-list {
width: 1200px;
margin: 20px auto;
width: 1200px;
margin: 20px auto;
.grid-content {
.grid-content {
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
width: 100%;
padding: 10px;
margin-bottom: 10px;
flex-direction: column;
.comments {
display: flex;
flex-direction: column;
justify-content: start;
align-items: flex-start;
line-height: 2em;
width: 100%;
.goods-name {
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
background-color: #fff;
width: 100%;
padding: 10px;
margin-bottom: 10px;
flex-direction: column;
align-items: flex-start;
}
.comments {
display: flex;
flex-direction: column;
justify-content: start;
align-items: flex-start;
line-height: 2em;
width: 100%;
.goods-name {
font-size: 16px;
display: flex;
align-items: center;
}
.goods-price {
color: #bf2b28;
font-size: 20px;
font-weight: 600;
}
}
.goods-price {
color: #bf2b28;
font-size: 20px;
font-weight: 600;
}
}
}
.bg-purple {
border-top: 1px solid #f3f3f3;
border-right: 1px solid #f3f3f3;
.bg-purple {
border-top: 1px solid #f3f3f3;
border-right: 1px solid #f3f3f3;
image {
width: 180px;
height: 180px;
}
image {
width: 180px;
height: 180px;
}
}
}
.pagination {
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
width: 1200px;
margin: 20px auto;
display: flex;
justify-content: center;
}
.recommend {
position: absolute;
right: 0;
top: 0;
padding: 5px;
background-color: #bf2b28;
color: white;
font-size: 30rpx;
z-index: 999;
}
</style>