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

515 lines
12 KiB

10 months ago
<template>
<view style="padding-bottom: 60rpx;">
9 months ago
<view class="section">
9 months ago
<u-field v-model="form.goods_name" label="商品名称" placeholder="请输入商品名称">
9 months ago
</u-field>
9 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="请输入商品数量">
9 months ago
</u-field>
10 months ago
</view>
<view class="section" style="padding-top: 26upx;">
9 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>
10 months ago
</view>
</view>
9 months ago
<view class="section">
9 months ago
<u-field v-model="form.receiver" label="收货人" placeholder="请输入收货人姓名">
9 months ago
</u-field>
<u-field v-model="form.receiver_phone" label="手机号" @input="handleInput" maxlength="11" type="number" placeholder="请输入收货人手机号">
9 months ago
</u-field>
9 months ago
<u-field @click="cityShow=true" v-model="city" :disabled="true" label="所属城市" placeholder="请选择所属城市"
9 months ago
right-icon="arrow-right">
</u-field>
<u-picker mode="region" v-model="cityShow" @confirm="regionChage">{{form.city}}</u-picker>
<view class="addrDetail">
<view class="addrTitle">
详细地址
</view>
9 months ago
<u-input type="textarea" v-model="form.detail" placeholder="请输入详细地址"></u-input>
10 months ago
</view>
</view>
9 months ago
<view class="section">
9 months ago
<picker @change="changeMode" mode="selector" range-key="text" :value="index" :range="modeList">
9 months ago
<u-field v-model="send_name" :disabled="true" label="发货模式" placeholder="请选择发货模式"
9 months ago
right-icon="arrow-right">
</u-field>
</picker>
9 months ago
<u-field v-model="form.send_company" label="发货公司" placeholder="请输入发货公司">
9 months ago
</u-field>
9 months ago
<u-field v-model="form.sender" label="发货人" placeholder="请输入发货人">
9 months ago
</u-field>
<u-field v-model="form.send_phone" label="发货人电话" type="number" @input="handleSendInput" maxlength="11" placeholder="请输入发货人电话">
9 months ago
</u-field>
9 months ago
<picker @change="changeOption" mode="selector" range-key="express_name" :value="index" :range="expressList">
9 months ago
<u-field v-model="form.express_name" :disabled="true" label="物流公司" placeholder="请选择物流公司"
9 months ago
right-icon="arrow-right">
</u-field>
</picker>
9 months ago
<u-field v-model="form.express_no" label="物流单号" placeholder="请输入物流单号">
9 months ago
</u-field>
</view>
<view class="recordList">
<view class="recordItem c">
<view class="recordTitle">
9 months ago
转账记录<text class="intro">最多上传6张</text>
9 months ago
</view>
<u-upload :action="action" :header="header" @on-uploaded="transferSuccess" width="180" height="180"
9 months ago
:file-list="transferList" :custom-btn="true" max-count="6">
9 months ago
<template v-slot:addBtn>
<view 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>
</template>
</u-upload>
</view>
<view class="recordItem c">
<view class="recordTitle">
9 months ago
聊天记录<text class="intro">最多上传6张</text>
9 months ago
</view>
<u-upload :action="action" :header="header" @on-uploaded="chatSuccess" width="180" height="180"
9 months ago
:file-list="chatList" :custom-btn="true" max-count="6">
9 months ago
<template v-slot:addBtn>
<view 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>
</template>
</u-upload>
10 months ago
</view>
</view>
9 months ago
<view class="footerBtn" @click="onSubmit">
提交
</view>
10 months ago
</view>
</template>
<script>
9 months ago
import * as UploadApi from '@/api/upload'
import * as newFunApi from '@/api/newFun'
import Config from '@/core/config'
export default {
data() {
return {
9 months ago
city: null,
send_name: null,
express_name: null,
9 months ago
form: {
9 months ago
goods_sn: '',
goods_num: null,
goods_price: '',
9 months ago
receiver: '',
receiver_phone: '',
detail: '',
send_type: null,
send_company: '',
sender: '',
send_phone: '',
9 months ago
express_id: '',
9 months ago
express_no: '',
transfer_image_id: '',
9 months ago
chat_image_id: '',
goods_name: '',
province_id: '',
city_id: '',
region_id: ''
9 months ago
},
content: '',
modeList: [{
10 months ago
text: '店内现货',
9 months ago
id: 0,
}, {
text: '仓库发货',
id: 1,
9 months ago
}],
cityShow: false,
transferList: [],
chatList: [],
9 months ago
expressList: [],
9 months ago
action: '',
action:'',
9 months ago
}
10 months ago
},
9 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",
10 months ago
}
9 months ago
this.getExpressAll()
10 months ago
},
9 months ago
methods: {
// 智能识别
onIntelligence() {
if (!this.content) {
return this.$toast('请输入识别内容')
}
newFunApi.analysis({
content: this.content
})
.then(res => {
if (res.status) {
let data = res.data.detail
this.form.city = data.region.province + data.region.city + data.region.region;
9 months ago
this.form.receiver = data.name
this.form.receiver_phone = data.phone
this.form.detail = data.detail
9 months ago
uni.showToast({
title: '识别成功',
icon: 'none',
duration: 2000
})
} else {
uni.showToast({
title: '识别失败',
icon: 'none',
duration: 2000
})
10 months ago
}
9 months ago
})
.finally()
},
// 提交信息
9 months ago
async onSubmit() {
9 months ago
const that = this;
9 months ago
if (!that.form.goods_name) {
9 months ago
return that.$toast('请选择商品名称')
}
9 months ago
if (!that.form.goods_sn) {
return that.$toast('请选择商品型号')
}
if (!that.form.goods_price) {
return that.$toast('请输入商品价格')
}
if (!that.form.goods_num) {
9 months ago
return that.$toast('请输入商品数量')
}
9 months ago
if (!that.form.receiver) {
9 months ago
return that.$toast('请输入收货人姓名')
}
9 months ago
if (!that.form.receiver_phone) {
9 months ago
return that.$toast('请输入收货人手机号')
}
9 months ago
if (!that.city) {
9 months ago
return that.$toast('请选择所属城市')
}
9 months ago
if (!that.form.detail) {
9 months ago
return that.$toast('请输入详细地址')
}
9 months ago
if (!that.send_name) {
9 months ago
return that.$toast('请选择发货模式')
}
9 months ago
if (!that.form.send_company) {
9 months ago
return that.$toast('请输入发货公司')
}
9 months ago
if (!that.form.sender) {
9 months ago
return that.$toast('请输入发货人')
}
9 months ago
if (!that.form.send_phone) {
9 months ago
return that.$toast('请输入发货手机号')
9 months ago
}
9 months ago
if (!that.express_name) {
9 months ago
return that.$toast('请选择物流公司')
}
9 months ago
if (!that.form.express_no) {
9 months ago
return that.$toast('请输入物流单号')
}
9 months ago
if (!that.form.transfer_image_id) {
9 months ago
return that.$toast('请上传转账记录')
9 months ago
}
9 months ago
let {
status,
message,
data
} = await newFunApi.addTransfer(that.form);
if (status == 200) {
uni.showToast({
title: "录入成功"
})
setTimeout(function() {
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;
9 months ago
}
},
9 months ago
changeMode(e) {
9 months ago
this.send_name = this.modeList[e.detail.value].text;
this.form.send_type = this.modeList[e.detail.value].id;
9 months ago
},
9 months ago
// 选择物流
changeOption(e) {
9 months ago
this.express_name = this.expressList[e.detail.value].express_name;
9 months ago
this.form.express_id = this.expressList[e.detail.value].express_id
9 months ago
},
/**
* 物流
*/
async getExpressAll() {
let {
status,
message,
data
} = await newFunApi.expressAll();
if (status == 200) {
this.expressList = data.list;
}
9 months ago
},
regionChage(e) {
9 months ago
console.log(e)
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
9 months ago
},
//接受上传返回的数据
transferSuccess(list) {
9 months ago
console.log(list)
9 months ago
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
9 months ago
let idList = []
list.forEach(item => {
idList.push(item.response.data.fileInfo.file_id)
});
this.form.transfer_image_id = idList.join(',');
10 months ago
}
9 months ago
}
},
//接受上传返回的数据
chatSuccess(list) {
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
9 months ago
let idList = []
list.forEach(item => {
idList.push(item.response.data.fileInfo.file_id)
});
this.form.chat_image_id = idList.join(',');
9 months ago
}
}
},
}
10 months ago
}
</script>
<style lang="scss" scoped>
9 months ago
page {
min-height: 100%;
background-color: #F7F8FA;
padding-bottom: 96upx;
}
.section {
background-color: #fff;
padding: 0 36upx;
9 months ago
margin-top: 16upx;
.realAddr {
padding: 40upx 0 !important;
::v-deep .uni-input-wrapper {
text-align: left !important;
}
::v-deep .uni-input-placeholder {
white-space: pre-wrap;
}
10 months ago
}
9 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;
}
10 months ago
}
}
9 months ago
.selectContent {
border-top: 1px solid transparent;
margin-top: 6upx;
padding-bottom: 100upx;
}
::v-deep .u-field {
padding: 20upx !important;
9 months ago
}
::v-deep .uni-input-wrapper {
text-align: right;
}
9 months ago
::v-deep .u-label {
flex: auto !important
}
9 months ago
::v-deep .u-flex-1 {
width: 400upx;
}
::v-deep .u-flex-1,
::v-deep .fild-body {
text-align: right;
margin: 0 !important;
}
::v-deep .u-input__textarea{
padding: 40upx 0 20upx 0 !important;
}
9 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;
}
}
}
10 months ago
}
9 months ago
.footerBtn {
9 months ago
width: 86%;
9 months ago
height: 88upx;
9 months ago
background: #FF5050;
9 months ago
border-radius: 36px 36px 36px 36px;
10 months ago
opacity: 1;
9 months ago
font-size: 28upx;
10 months ago
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #FFFFFF;
9 months ago
line-height: 88upx;
text-align: center;
margin: 76upx auto 0upx auto;
9 months ago
10 months ago
}
9 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;
}
10 months ago
}
}
9 months ago
</style>