You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
yanzong_qianduan/pages/news/recycling/confirm1.vue

824 lines
19 KiB

<template>
<view class="recycling">
<view class="recycling-hd">
<image :src="$picUrl+'/static/news/recyling-banner-01'"></image>
</view>
<view class="recycling-bd">
<view class="tab">
<view class="a">
<view class="item" @click="tabItem(0)"></view>
<view class="item" @click="tabItem(1)"></view>
<view class="item" @click="tabItem(2)"></view>
</view>
<view class="b">
<image v-if="tabIndex == 0" :src="$picUrl+'/static/news/icon-recyling-tab-01.png'"></image>
<image v-if="tabIndex == 1" :src="$picUrl+'/static/news/icon-recyling-tab-02.png'"></image>
<image v-if="tabIndex == 2" :src="$picUrl+'/static/news/icon-recyling-tab-03.png'"></image>
</view>
</view>
<view class="goods">
<view class="a">
<image :src="$picUrl+'/static/news/icon-mall.jpg'"></image>{{storeInfo.shop_name}}
</view>
<view class="b">
<view class="l">
<image class="pic" :src="storeInfo.logo_url"></image>
<view class="info">
<view class="tel">{{storeInfo.linkman}}{{storeInfo.phone}}</view>
<view class="address">{{storeInfo.address}}</view>
<view class="time">营业时间:{{storeInfo.shop_hours}}</view>
</view>
<view class="do">
<view class="tel" @click="openPage(1,storeInfo.phone)">
<image :src="$picUrl+'/static/news/tel.png'"></image>电话
</view>
<view class="tel" @click="openPage(2)">
<image :src="$picUrl+'/static/news/address.png'"></image>导航
</view>
</view>
</view>
<view class="r">
<image class="pic" :src="info.recovery_image"></image>
<view class="info">
<view class="tel">{{info.recovery_name}}</view>
<view class="price">免支付预约</view>
</view>
<view class="num">
x1
</view>
</view>
</view>
</view>
<view class="form">
<view class="item">
<view class="a">品牌</view>
<view class="b">
<input class="box" type="text" v-model="obj.brand" placeholder="品牌" />
</view>
</view>
<view class="item">
<view class="a">型号</view>
<view class="b">
<input class="box" type="text" v-model="obj.model" placeholder="型号" />
</view>
</view>
<view class="item">
<view class="a">服务时间</view>
<view class="b" @click="openPage(3)">
<view class="select" :class="obj.server_time?'select-on':''">
{{obj.server_time?obj.server_time:(tabIndex <= 1?'请选择预约到店时间':'请选择预计寄出商品的时间')}}
</view>
<u-icon style="margin-left: 10rpx;" name="arrow-right"></u-icon>
</view>
</view>
<view class="item">
<view class="a">联系人</view>
<view class="b">
<input class="box1" v-model="obj.username" type="text" placeholder="联系人姓名" />
<view class="radio">
<u-radio-group v-model="obj.sex" active-color="red">
<u-radio name="先生" lable='1'>先生</u-radio>
<u-radio name="女士" lable='2'>女士</u-radio>
</u-radio-group>
</view>
</view>
</view>
<view class="item">
<view class="a">联系电话</view>
<view class="b">
<input class="box" type="number" v-model="obj.mobile" placeholder="联系人手机号码" />
</view>
</view>
<view class="item" v-if="tabIndex == 2 ||tabIndex == 1">
<view class="a">联系人微信</view>
<view class="b">
<input class="box" v-model="obj.wx_account" type="text" placeholder="联系人微信号码" />
</view>
</view>
<view class="item" v-if="tabIndex == 2 ||tabIndex == 1">
<view class="a" @click="addrshow=true">发件地址</view>
<view class="b" @click="addrshow=true">
<input type="text" disabled placeholder="请选择地址" v-model="obj.shipping_address">
<u-picker @confirm="changeRegion" v-model="addrshow" mode="region"></u-picker>
</view>
</view>
<view class="item" v-if="tabIndex == 2 ||tabIndex == 1">
<view class="a">门牌号</view>
<view class="b">
<input class="box" type="text" v-model="obj.house_number" placeholder="例:12幢1单元102室" />
</view>
</view>
<view class="item">
<view class="a">期待卖价</view>
<view class="b">
<input class="box" v-model="obj.expect_price" type="number" placeholder="请输入您期待的售卖价格(元)" />
</view>
</view>
<view class="photo">
<view class="file_img" v-for="(image, imageIndex) in imageList" :key="imageIndex">
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
<image :src="image.path"></image>
</view>
<view @click="chooseImage" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image src="/static/news/icon-upload.png"></image>
<view class="1">上传图片</view>
<view class="1">{{imageList.length>0?imageList.length:0}}/{{maxImageLength}}</view>
</view>
</view>
<view class="remark">
<view class="name">备注 </view>
<view class="xu">
<view class="li" @click="openPage(5,'可提前来')">可提前来</view>
<view class="li" @click="openPage(5,'来之前打电话')">来之前打电话</view>
<view class="li" @click="openPage(5,'请尽快联系我')">请尽快联系我</view>
</view>
<view class="content">
<u-input v-model="obj.remake" height="260" type="textarea" placeholder="请输入您的留言,最多可留言100字"
:border="true" />
</view>
</view>
</view>
</view>
<view class="recycling-fd">
<view class="a">免支付预购</view>
<view class="b" @click="openPage(4)">提交订单</view>
</view>
<!-- 时间选择器 -->
<u-picker mode="time" :params="params" v-model="show" confirm-color="#FE483B" :show-time-tag="false"
@confirm="confirm"></u-picker>
<u-mask :show="isShow" @click="isShow = false">
<view class="order-dialog">
<image class="pic" :src="$picUrl+'/static/news/icon-recycling-order-04.png'"></image>
<view class="a">回收订单提交成功</view>
<view class="b">感谢您对低碳环保做出的努力!</view>
<view class="c" @click="onLook">查看订单</view>
</view>
</u-mask>
</view>
</template>
<script>
import Config from '@/core/config'
import * as newFunApi from '@/api/newFun'
import * as UploadApi from '@/api/upload'
export default {
data() {
return {
info: {},
isShow: false,
type: 1,
tabIndex: 0,
params: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true
},
addrshow: false,
show: false,
storeInfo: {},
region: [],
url: Config.get('apiUrl') + 'user/upload',
obj: {
recovery_id: '', //回收ID
shop_id: '', //门店ID
recovery_type: '', //10上门20门店30邮寄
username: '', //姓名
server_time: '', //mobile:'',//手机号
expect_price: '', //期望价
sex: 1, //1男2女
remake: '', //备注
brand: '', //品牌
model: '', //型号
wx_account: '', //微信账号
house_number: '', //门牌号-邮寄、上门必填
shipping_address: '', //联系地址-邮寄、上门必填
express_id: '', //快递ID
express_no: '', //否快递单号
image_ids: '', //图片ID(数组或以逗号字符串)
},
imageList: [],
maxImageLength: 6
}
},
onLoad(op) {
this.tabIndex = op.tabIndex;
this.info = uni.getStorageSync("getInfo")
this.storeInfo = uni.getStorageSync("storeHsInfo")
if (op.infor) {
this.info = op.infor ? JSON.parse(op.infor) : ''
this.obj = op.infor ? JSON.parse(op.infor) : this.obj
}
},
methods: {
// 删除图片
deleteImage(imageIndex) {
this.imageList.splice(imageIndex, 1)
},
// 选择图片
chooseImage() {
const app = this
const oldImageList = app.imageList
// 选择图片
uni.chooseImage({
count: app.maxImageLength - oldImageList.length,
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success({
tempFiles
}) {
app.imageList = oldImageList.concat(tempFiles)
}
});
},
// 上传图片
uploadFile() {
const app = this
const {
imageList
} = app
// 批量上传
return new Promise((resolve, reject) => {
if (imageList.length > 0) {
UploadApi.image(imageList)
.then(fileIds => {
app.obj.image_ids = fileIds;
resolve(fileIds)
})
.catch(reject)
} else {
resolve()
}
})
},
tabItem(i) {
this.tabIndex = i
},
confirm(e) {
this.obj.server_time = e.year + "-" + e.month + '-' + e.day + " " + e.hour + ":" + e.minute + ':' + e
.second
},
changeRegion(e) {
this.addrshow = false
this.obj.shipping_address = e.province.name + e.city.name + e.area.name;
},
openPage(i, msg) {
if (i == 1) { //电话
uni.makePhoneCall({
phoneNumber: msg
})
}
if (i == 2) { //导航
uni.openLocation({
latitude: this.storeInfo.latitude,
longitude: this.storeInfo.longitude,
complete: function(res) {
console.log(res);
}
});
}
if (i == 3) { //服务事件
this.show = true
}
if (i == 4) { //提交
if (this.tabIndex == 0) {
this.obj.recovery_type = 20
}
if (this.tabIndex == 1) {
this.obj.recovery_type = 10
}
if (this.tabIndex == 2) {
this.obj.recovery_type = 30
}
this.obj.shop_id = this.storeInfo.shop_id;
this.obj.recovery_id = this.info.recovery_id;
if (!this.obj.brand) {
uni.showToast({
title: '请输入品牌',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.model) {
uni.showToast({
title: '请输入型号',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.server_time) {
uni.showToast({
title: '请选择服务时间',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.username) {
uni.showToast({
title: '请输入姓名',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.mobile) {
uni.showToast({
title: '请输入手机号',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.expect_price) {
uni.showToast({
title: '请输入期望价',
icon: 'none',
duration: 2000
})
return
}
if (this.tabIndex == 2) {
if (!this.obj.wx_account) {
uni.showToast({
title: '请输入微信账号',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.shipping_address) {
uni.showToast({
title: '请选择联系地址',
icon: 'none',
duration: 2000
})
return
}
if (!this.obj.house_number) {
uni.showToast({
title: '请输入门牌号',
icon: 'none',
duration: 2000
})
return
}
}
this.uploadFile()
newFunApi.addOrder(this.obj).then(res => {
if (res.status == 200) {
this.isShow = true
} else {
uni.showToast({
title: res.message
})
}
})
}
if (i == 5) { //备注
this.obj.remake = msg
}
},
onLook() {
uni.redirectTo({
url: "/pages/news/recycling/orderList"
})
},
}
}
</script>
<style lang="scss" scoped>
.recycling {
min-height: 100vh;
background-color: #FFFFFF;
padding-bottom: 130rpx;
overflow: hidden;
.slot-btn {
width: 80px;
height: 80px;
background: #FFFFFF;
border-radius: 10rpx;
border: 1px solid #C0C0C0;
text-align: center;
font-size: 24rpx;
font-weight: 500;
color: #D1D1D1;
image {
width: 50rpx;
height: 50rpx;
margin-top: 20rpx;
}
}
&-hd {
width: 686rpx;
height: 152rpx;
border-radius: 8rpx;
overflow: hidden;
margin: 0 auto;
margin-top: 30rpx;
image {
width: 100%;
height: 100%;
}
}
&-bd {
width: 690rpx;
min-height: 280rpx;
overflow: hidden;
margin: 0 auto;
margin-top: 30rpx;
position: relative;
.tab {
width: 690rpx;
height: 280rpx;
.b {
width: 100%;
height: 100%;
display: block;
image {
width: 100%;
height: 100%;
display: block;
}
}
.a {
width: 100%;
height: 98rpx;
position: absolute;
left: 0;
top: 0;
z-index: 2;
display: flex;
align-items: center;
.item {
flex: 1;
height: 100%;
}
}
}
.goods {
padding: 30rpx 35rpx;
overflow: hidden;
border-left: 1px solid #F1F1F1;
border-right: 1px solid #F1F1F1;
.a {
display: flex;
align-items: center;
image {
width: 50rpx;
height: 50rpx;
margin-right: 10rpx;
}
font-size: 28rpx;
font-weight: 500;
color: #000000;
}
.b {
padding: 20rpx 0;
overflow: hidden;
.l {
display: flex;
align-items: center;
overflow: hidden;
.pic {
width: 182rpx;
height: 146rpx;
border-radius: 6rpx;
margin-right: 10rpx;
}
.info {
width: 305rpx;
margin-right: 20rpx;
.title {
font-size: 24rpx;
font-weight: 400;
color: #5C5C5C;
}
.address {
font-size: 24rpx;
font-weight: 400;
color: #5C5C5C;
height: 80rpx;
line-height: 40rpx;
overflow: hidden;
}
.time {
font-size: 24rpx;
font-weight: 400;
color: #5C5C5C;
}
}
.do {
flex: 1;
text-align: center;
font-size: 20rpx;
font-weight: 400;
color: #989898;
display: flex;
align-items: center;
justify-content: space-between;
image {
width: 30rpx;
height: 30rpx;
display: block;
margin: 0 auto;
margin-bottom: 20rpx;
}
}
}
.r {
display: flex;
align-items: flex-start;
overflow: hidden;
margin-top: 30rpx;
.pic {
width: 182rpx;
height: 146rpx;
border-radius: 6rpx;
margin-right: 10rpx;
}
.info {
width: 305rpx;
margin-right: 20rpx;
.title {
font-size: 28rpx;
font-weight: 400;
color: #212121;
}
.price {
font-size: 32rpx;
font-weight: 500;
color: #FF584D;
margin-top: 20rpx;
}
}
.num {
flex: 1;
text-align: center;
font-size: 30rpx;
font-weight: 400;
color: #989898;
text-align: right;
}
}
}
}
.form {
padding: 0 40rpx;
overflow: hidden;
border-left: 1px solid #F1F1F1;
border-right: 1px solid #F1F1F1;
border-bottom: 1px solid #F1F1F1;
.remark {
.name {
font-size: 28rpx;
font-weight: 400;
color: #313131;
}
.xu {
display: flex;
flex-wrap: wrap;
overflow: hidden;
.li {
line-height: 52rpx;
background: #FFFFFF;
border-radius: 6rpx;
border: 1px solid #EDEDED;
padding: 0 20rpx;
margin-right: 20rpx;
text-align: center;
font-size: 24rpx;
font-weight: 400;
color: #949494;
margin-top: 20rpx;
}
}
.content {
padding: 20rpx 0 50rpx;
font-size: 28rpx;
color: #212121;
}
}
.photo {
display: flex;
justify-content: flex-start;
padding: 20rpx 0;
overflow: hidden;
}
.item {
padding: 20rpx 0;
border-bottom: 1px solid #F4F4F4;
display: flex;
align-items: center;
.a {
width: 160rpx;
font-size: 28rpx;
font-weight: 400;
color: #313131;
line-height: 45rpx;
}
.b {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
.select {
flex: 1;
font-size: 28rpx;
font-weight: 400;
line-height: 45rpx;
color: #949494;
&-on {
color: #212121;
}
}
.box {
flex: 1;
font-size: 28rpx;
color: #212121;
line-height: 45rpx;
}
.box1 {
width: 160rpx;
font-size: 28rpx;
color: #212121;
line-height: 45rpx;
}
.radio {
display: flex;
align-items: center;
justify-content: flex-end;
flex: 1;
border-left: 1px solid #E6E6E6;
}
}
}
}
}
&-fd {
width: 100%;
height: 120rpx;
background-color: #FFFFFF;
padding: 25rpx 25rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
.a {
font-size: 28rpx;
font-weight: 400;
color: #727272;
}
.b {
width: 502rpx;
height: 88rpx;
line-height: 88rpx;
background: #FE483B;
border-radius: 88rpx;
text-align: center;
font-size: 28rpx;
font-weight: 600;
color: #FFFFFF;
}
}
.order-dialog {
width: 16.78125rem;
height: 12.9375rem;
background: linear-gradient(180deg, #FFE4E4 0%, #FFFFFF 100%);
border-radius: 0.375rem;
position: absolute;
left: 50%;
top: 50%;
margin-left: -8.375rem;
margin-top: -6.46875rem;
z-index: 2;
text-align: center;
padding-top: 3.125rem;
box-sizing: border-box;
.pic {
width: 112rpx;
height: 128rpx;
position: absolute;
left: 50%;
margin-left: -56rpx;
top: -60rpx;
z-index: 2;
}
.a {
font-size: 32rpx;
font-weight: 500;
color: #000000;
}
.b {
font-size: 28rpx;
font-weight: 400;
color: #727272;
margin-top: 30rpx;
}
.c {
width: 412rpx;
line-height: 72rpx;
background: #F55349;
border-radius: 8rpx;
font-size: 28rpx;
color: #FFFFFF;
margin: 0 auto;
margin-top: 60rpx;
}
}
}
.photo {
display: flex;
justify-content: flex-start;
padding: 20rpx 0;
overflow: hidden;
}
.file_img {
overflow: hidden;
position: relative;
image {
width: 80px;
height: 80px;
margin-right: 10rpx;
}
.image-delete {
position: absolute;
top: -10rpx;
right: -10rpx;
height: 42rpx;
width: 42rpx;
background: rgba(0, 0, 0, 0.64);
border-radius: 50%;
color: #fff;
font-weight: bolder;
font-size: 22rpx;
z-index: 10;
display: flex;
justify-content: center;
align-items: center;
}
}
</style>