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/news3/ManualEntry.vue

565 lines
14 KiB

11 months ago
<template>
<view style="padding-bottom: 200rpx;">
10 months ago
<view class="section">
10 months ago
<u-field v-model="form.goods_name" label="商品名称" placeholder="请输入商品名称">
10 months ago
</u-field>
10 months ago
<u-field v-model="form.goods_sn" label="商品型号" placeholder="请输入商品型号">
</u-field>
<u-field v-model="form.goods_price" label="商品价格" placeholder="请输入商品价格">
</u-field>
<u-field v-model="form.goods_num" type="number" label="商品数量" placeholder="请输入商品数量">
10 months ago
</u-field>
11 months ago
</view>
<view class="section" style="padding-top: 26upx;">
10 months ago
<u-input class="realAddr" type="textarea" placeholder="请粘贴或输入文本,点击“识别”自动识别姓名、电话和地址" v-model="content">
</u-input>
<view class="btnContent">
<view class="btn" @click="onIntelligence" :style="{'opacity': content?1:0.6 }">
识别
</view>
11 months ago
</view>
</view>
10 months ago
<view class="section">
10 months ago
<u-field v-model="form.receiver" label="收货人" placeholder="请输入收货人姓名">
10 months ago
</u-field>
9 months ago
<u-field v-model="form.receiver_phone" label="手机号" @blur="handleInput" maxlength="11" type="number"
10 months ago
placeholder="请输入收货人手机号">
10 months ago
</u-field>
10 months ago
<u-field @click="cityShow=true" v-model="city" :disabled="true" label="所属城市" placeholder="请选择所属城市"
10 months ago
right-icon="arrow-right">
</u-field>
9 months ago
<u-picker mode="region" v-model="cityShow" @confirm="regionChage">{{city}}</u-picker>
10 months ago
<view class="addrDetail">
<view class="addrTitle">
详细地址
</view>
10 months ago
<u-input type="textarea" v-model="form.detail" placeholder="请输入详细地址"></u-input>
11 months ago
</view>
</view>
10 months ago
<view class="section">
10 months ago
<picker @change="changeMode" mode="selector" range-key="text" :value="index" :range="modeList">
10 months ago
<u-field v-model="send_name" :disabled="true" label="发货模式" placeholder="请选择发货模式"
10 months ago
right-icon="arrow-right">
</u-field>
</picker>
10 months ago
<u-field v-model="form.send_company" label="发货公司" placeholder="请输入发货公司">
10 months ago
</u-field>
10 months ago
<u-field v-model="form.sender" label="发货人" placeholder="请输入发货人">
10 months ago
</u-field>
9 months ago
<u-field v-model="form.send_phone" label="发货人电话" type="number" @blur="handleSendInput" maxlength="11"
10 months ago
placeholder="请输入发货人电话">
10 months ago
</u-field>
<u-field v-model="form.transfer_date" @click="show=true" :disabled="true" label="调货时间" placeholder="请选择调货时间"
right-icon="arrow-right">
</u-field>
10 months ago
<picker @change="changeOption" mode="selector" range-key="express_name" :value="index" :range="expressList">
9 months ago
<u-field v-model="express_name" :disabled="true" label="物流公司" placeholder="请选择物流公司"
10 months ago
right-icon="arrow-right">
</u-field>
</picker>
10 months ago
<u-field v-model="form.express_no" label="物流单号" placeholder="请输入物流单号">
10 months ago
</u-field>
</view>
<view class="recordList">
<view class="recordItem c">
<view class="recordTitle">
10 months ago
转账记录<text class="intro">最多上传6张</text>
10 months ago
</view>
<u-upload :action="action" :header="header" @on-uploaded="transferSuccess" @on-remove="transferRemove"
width="180" height="180" :file-list="transferList" :custom-btn="true" max-count="6">
10 months ago
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image :src="$picUrl+'/static/news/icon-upload.png'"></image>
10 months ago
<view class="1">上传图片</view>
</view>
</template>
</u-upload>
</view>
<view class="recordItem c">
<view class="recordTitle">
10 months ago
聊天记录<text class="intro">最多上传6张</text>
10 months ago
</view>
<u-upload :action="action" :header="header" @on-uploaded="chatSuccess" @on-remove="chatRemove"
width="180" height="180" :file-list="chatList" :custom-btn="true" max-count="6">
10 months ago
<template v-slot:addBtn>
<view class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image :src="$picUrl+'/static/news/icon-upload.png'"></image>
10 months ago
<view class="1">上传图片</view>
</view>
</template>
</u-upload>
11 months ago
</view>
</view>
<u-picker mode="time" :params="params" v-model="show" confirm-color="#FE483B" :show-time-tag="false"
@confirm="confirm"></u-picker>
<view class="goods-fd">
<view class="btn" @click="onSubmit">提交</view>
10 months ago
</view>
11 months ago
</view>
</template>
<script>
10 months ago
import * as UploadApi from '@/api/upload'
import * as newFunApi from '@/api/newFun'
import Config from '@/core/config'
export default {
data() {
return {
show:false,
params: {
year: true,
month: true,
day: true,
hour: true,
minute: true,
second: true
},
10 months ago
city: null,
send_name: null,
express_name: null,
10 months ago
form: {
10 months ago
goods_sn: '',
goods_num: null,
goods_price: '',
10 months ago
receiver: '',
receiver_phone: '',
detail: '',
send_type: null,
send_company: '',
sender: '',
send_phone: '',
10 months ago
express_id: '',
10 months ago
express_no: '',
transfer_image_id: '',
10 months ago
chat_image_id: '',
goods_name: '',
province_id: '',
city_id: '',
9 months ago
region_id: '',
order_id: '',
transfer_date:'',
10 months ago
},
content: '',
modeList: [{
11 months ago
text: '店内现货',
10 months ago
id: 0,
}, {
text: '仓库发货',
id: 1,
10 months ago
}],
cityShow: false,
transferList: [],
chatList: [],
10 months ago
expressList: [],
10 months ago
action: '',
10 months ago
header: '',
10 months ago
}
11 months ago
},
9 months ago
onLoad(o) {
this.form.order_id = o.order_id
},
10 months ago
onReady() {
this.action = (Config.get('apiUrl') + 'upload/image').replace("index.php?s=/", "")
this.header = {
'Storeid': uni.getStorageSync('Store').storeInfo.store_id,
'Access-Token': uni.getStorageSync('AccessToken'),
'platform': "MP-WEIXIN",
11 months ago
}
10 months ago
this.getExpressAll()
11 months ago
},
10 months ago
methods: {
confirm(e) {
this.form.transfer_date = e.year + "-" + e.month + '-' + e.day + " " + e.hour + ":" + e.minute + ':' +
e
.second
},
10 months ago
// 智能识别
onIntelligence() {
if (!this.content) {
return this.$toast('请输入识别内容')
}
newFunApi.analysis({
content: this.content
})
.then(res => {
if (res.status) {
let data = res.data.detail
9 months ago
this.city = data.region.province + data.region.city + data.region.region;
this.form.province_id = data.province_id
this.form.city_id = data.city_id
this.form.region_id = data.region_id
10 months ago
this.form.receiver = data.name
this.form.receiver_phone = data.phone
this.form.detail = data.detail
10 months ago
uni.showToast({
title: '识别成功',
icon: 'none',
duration: 2000
})
} else {
uni.showToast({
title: '识别失败',
icon: 'none',
duration: 2000
})
11 months ago
}
10 months ago
})
.finally()
},
// 提交信息
10 months ago
async onSubmit() {
10 months ago
const that = this;
10 months ago
if (!that.form.goods_name) {
10 months ago
return that.$toast('请选择商品名称')
}
10 months ago
if (!that.form.goods_sn) {
return that.$toast('请选择商品型号')
}
if (!that.form.goods_price) {
return that.$toast('请输入商品价格')
}
if (!that.form.goods_num) {
10 months ago
return that.$toast('请输入商品数量')
}
10 months ago
if (!that.form.receiver) {
10 months ago
return that.$toast('请输入收货人姓名')
}
10 months ago
if (!that.form.receiver_phone) {
10 months ago
return that.$toast('请输入收货人手机号')
}
10 months ago
if (!that.city) {
10 months ago
return that.$toast('请选择所属城市')
}
10 months ago
if (!that.form.detail) {
10 months ago
return that.$toast('请输入详细地址')
}
10 months ago
if (!that.send_name) {
10 months ago
return that.$toast('请选择发货模式')
}
10 months ago
if (!that.form.send_company) {
10 months ago
return that.$toast('请输入发货公司')
}
10 months ago
if (!that.form.sender) {
10 months ago
return that.$toast('请输入发货人')
}
10 months ago
if (!that.form.send_phone) {
10 months ago
return that.$toast('请输入发货手机号')
10 months ago
}
if (!that.form.transfer_date) {
return that.$toast('请选择调货时间')
}
10 months ago
if (!that.express_name) {
10 months ago
return that.$toast('请选择物流公司')
}
10 months ago
if (!that.form.express_no) {
10 months ago
return that.$toast('请输入物流单号')
}
10 months ago
if (!that.form.transfer_image_id) {
10 months ago
return that.$toast('请上传转账记录')
10 months ago
}
10 months ago
let {
status,
message,
data
} = await newFunApi.addTransfer(that.form);
if (status == 200) {
uni.showToast({
title: "录入成功"
})
setTimeout(function() {
10 months ago
uni.$emit('refreshData');
uni.navigateBack({
delta: 1
})
}, 2000);
}
},
handleSendInput(e) {
if (this.validatePhoneNumber(event.target.value)) {
this.form.send_phone = event.target.value
} else {
this.form.send_phone = ''
}
},
handleInput(e) {
if (this.validatePhoneNumber(event.target.value)) {
this.form.receiver_phone = event.target.value
} else {
this.form.receiver_phone = ''
}
},
validatePhoneNumber(phone) {
var regExp = /^1[3456789]\d{9}$/;
if (regExp.test(phone)) {
return true;
} else {
return this.$toast('手机号不合法')
return false;
10 months ago
}
},
10 months ago
changeMode(e) {
10 months ago
this.send_name = this.modeList[e.detail.value].text;
this.form.send_type = this.modeList[e.detail.value].id;
10 months ago
},
10 months ago
// 选择物流
changeOption(e) {
9 months ago
console.log(e)
10 months ago
this.express_name = this.expressList[e.detail.value].express_name;
10 months ago
this.form.express_id = this.expressList[e.detail.value].express_id
10 months ago
},
/**
* 物流
*/
async getExpressAll() {
let {
status,
message,
data
} = await newFunApi.expressAll();
if (status == 200) {
this.expressList = data.list;
}
10 months ago
},
regionChage(e) {
10 months ago
this.city = e.province.name + e.city.name + e.area.name;
this.form.province_id = e.province.code;
this.form.city_id = e.city.code
this.form.region_id = e.area.code
10 months ago
},
//接受上传返回的数据
transferSuccess(list) {
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
10 months ago
this.form.transfer_image_id = this.handleRemove('', list);
11 months ago
}
10 months ago
}
},
transferRemove(file, fileList) {
this.form.transfer_image_id = this.handleRemove(file, fileList);
},
handleRemove: function(file, fileList) {
let idList = []
fileList.forEach(item => {
idList.push(item.response.data.fileInfo.file_id)
});
return idList.join(',')
},
chatRemove(file, fileList) {
10 months ago
this.form.chat_image_id = this.handleRemove(file, fileList);
},
10 months ago
//接受上传返回的数据
chatSuccess(list) {
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
10 months ago
this.form.chat_image_id = this.handleRemove('', list);
10 months ago
}
}
},
}
11 months ago
}
</script>
<style lang="scss" scoped>
10 months ago
page {
min-height: 100%;
background-color: #F7F8FA;
padding-bottom: 96upx;
}
.section {
background-color: #fff;
padding: 0 36upx;
10 months ago
margin-top: 16upx;
.realAddr {
9 months ago
// padding: 40upx 0 !important;
10 months ago
::v-deep .uni-input-wrapper {
text-align: left !important;
}
::v-deep .uni-input-placeholder {
white-space: pre-wrap;
}
11 months ago
}
10 months ago
.btnContent {
display: flex;
justify-content: flex-end;
padding-bottom: 30upx;
}
.btn {
width: 120upx;
height: 50upx;
background: #FE483B;
border-radius: 19px 19px 19px 19px;
opacity: 1;
line-height: 50upx;
text-align: center;
font-size: 24upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #FFFFFF;
}
.addrDetail {
padding: 0 10upx;
.addrTitle {
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #303030;
margin-top: 32upx;
}
11 months ago
}
}
10 months ago
.selectContent {
border-top: 1px solid transparent;
margin-top: 6upx;
padding-bottom: 100upx;
}
10 months ago
::v-deep .u-list-item {
margin: 10rpx 20rpx 10rpx 0 !important;
}
10 months ago
::v-deep .u-field {
padding: 20upx !important;
10 months ago
}
::v-deep .uni-input-wrapper {
text-align: right;
}
10 months ago
::v-deep .u-label {
flex: auto !important
}
10 months ago
::v-deep .u-flex-1 {
width: 400upx;
}
::v-deep .u-flex-1,
::v-deep .fild-body {
text-align: right;
margin: 0 !important;
}
10 months ago
::v-deep .u-input__textarea {
padding: 40upx 0 20upx 0 !important;
}
10 months ago
10 months ago
.recordList {
padding: 30upx;
background-color: #fff;
margin-top: 14upx;
.recordItem {
.recordTitle {
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #353535;
margin-bottom: 20upx;
.intro {
font-size: 24upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #9F9F9F;
margin-left: 28upx;
}
}
.picList {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
margin: 12upx 0;
text-align: center;
image {
width: 200upx;
height: 160upx;
}
}
}
11 months ago
}
10 months ago
.goods-fd {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
padding: 0.9375rem;
z-index: 99;
background-color: #fafafa;
box-sizing: border-box;
10 months ago
.btn {
width: 630rpx;
line-height: 88rpx;
background: #F34A40;
border-radius: 88rpx;
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: #FFFFFF;
margin: auto;
}
11 months ago
}
10 months ago
10 months ago
.c {
padding-top: 20rpx;
overflow: hidden;
.slot-btn {
width: 180rpx;
height: 180rpx;
background: #F6F6F6;
border-radius: 10rpx;
border: 1px solid #C0C0C0;
text-align: center;
font-size: 28rpx;
font-weight: 500;
color: #6D6D6D;
.l {
line-height: 30rpx;
}
image {
width: 50rpx;
height: 50rpx;
display: block;
margin: 0 auto;
margin-top: 30rpx;
}
11 months ago
}
}
10 months ago
</style>