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/seasoningCondimentsRecord.vue

435 lines
10 KiB

10 months ago
<template>
<view style="padding-bottom: 42rpx;">
9 months ago
<view class="selectContent" style="border:none;background-color: #fff;">
<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="请输入发货公司">
10 months ago
</u-field>
<u-field v-model="form.sender" label="发货人" placeholder="请输入发货人名称">
9 months ago
</u-field>
<u-field v-model="form.send_phone" type="number" @input="handleInput" maxlength="13" label="发货人电话"
placeholder="请输入发货人手机号">
9 months ago
</u-field>
<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="请选择物流公司"
9 months ago
right-icon="arrow-right">
</u-field>
</picker>
<view class="wuliu">
9 months ago
<u-field class='fanfan' style="flex: 1;padding:30upx 0 30upx 30upx" v-model="form.express_no"
label="物流单号" placeholder="请填写物流单号">
9 months ago
</u-field>
<view class="getWuliu" @click="onLogistics">
查看物流
10 months ago
</view>
</view>
9 months ago
<view class="recordList">
9 months ago
<view class="recordItem c">
9 months ago
<view class="recordTitle">
9 months ago
转账记录<text class="intro">最多上传6张</text>
9 months ago
</view>
<u-upload :action="action" :header="header" @on-uploaded="transferSuccess"
@on-remove="onRemoveTransfer" width="180" height="180" :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>
10 months ago
</view>
9 months ago
<view class="recordItem c">
9 months ago
<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"
@on-remove="onRemoveChat" height="180" :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>
</view>
<view class="footerBtn" @click="onSubmit">
保存
</view>
10 months ago
</view>
</template>
<script>
9 months ago
import * as newFunApi from '@/api/newFun'
9 months ago
import Config from '@/core/config'
9 months ago
export default {
data() {
return {
9 months ago
send_name: '',
express_name: '',
form: {},
9 months ago
modeList: [{
10 months ago
text: '店内现货',
9 months ago
id: 0,
}, {
text: '仓库发货',
id: 1,
9 months ago
}],
expressList: [],
9 months ago
action: '',
action: '',
transferList: [],
handleList: [],
9 months ago
chatList: [],
handChatList: [],
9 months ago
}
},
onLoad(o) {
this.form = JSON.parse(o.item)
this.send_name = this.modeList[this.form.send_type].text;
this.transferList = this.form.transfer_image_ids;
this.chatList = this.form.chat_image_ids;
console.log(this.form)
if (this.form.transfer_image_ids) {
let list = this.form.transfer_image_ids
list.forEach(item => {
item.url = item.file_path;
9 months ago
});
this.transferList = list
}
if (this.form.chat_image_ids) {
let list = this.form.chat_image_ids
list.forEach(item => {
item.url = item.file_path;
9 months ago
});
this.chatList = list
9 months ago
}
10 months ago
},
9 months ago
onReady() {
9 months ago
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",
}
9 months ago
this.getExpressAll()
9 months ago
},
9 months ago
methods: {
handleInput(e) {
if (this.validatePhoneNumber(event.target.value)) {
this.form.send_phone = event.target.value
} else {
this.form.send_phone = ''
}
},
validatePhoneNumber(phone) {
var regExp = /^1[3456789]\d{9}$/;
if (regExp.test(phone)) {
return true;
} else {
return this.$toast('手机号不合法')
return false;
}
},
9 months ago
// 提交信息
async onSubmit() {
const that = this;
// 转账记录
let trList = []
this.transferList = this.transferList.concat(this.handleList);
this.transferList.forEach(item => {
trList.push(item.file_id)
});
this.form.transfer_image_id = trList.join(',');
// 聊天记录
let atList = []
this.chatList = this.chatList.concat(this.handChatList);
this.chatList.forEach(item => {
atList.push(item.file_id)
});
this.form.chat_image_id = atList.join(',');
9 months ago
console.log(that.form)
if (!that.send_name) {
return that.$toast('请选择发货模式')
}
if (!that.form.send_company) {
return that.$toast('请输入发货公司')
}
if (!that.form.sender) {
return that.$toast('请输入发货人')
}
if (!that.form.send_phone) {
return that.$toast('请输入发货手机号')
}
if (!that.express_name) {
return that.$toast('请选择物流公司')
}
if (!that.form.express_no) {
return that.$toast('请输入物流单号')
}
if (!that.form.transfer_image_id) {
return that.$toast('请上传转账记录')
}
let parmes = {
id: that.form.id,
send_type: that.form.send_type,
send_company: that.form.send_company,
sender: that.form.sender,
send_phone: that.form.send_phone,
express_no: that.form.express_no,
express_id: that.form.express_id,
chat_image_id: that.form.chat_image_id,
transfer_image_id: that.form.transfer_image_id,
}
9 months ago
let {
status,
message,
data
} = await newFunApi.editTransfer(parmes);
9 months ago
if (status == 200) {
uni.showToast({
title: "录入成功"
})
setTimeout(function() {
uni.$emit('refreshData');
uni.navigateBack({
delta: 1
})
}, 2000);
9 months ago
}
},
9 months ago
changeMode(e) {
this.form.setGoodsMode = this.modeList[e.detail.value].text;
},
// 选择物流
changeOption(e) {
9 months ago
this.express_name = this.expressList[e.detail.value].express_name;
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
this.express_name = this.findNameById(this.expressList, this.form.express_id)
9 months ago
}
},
9 months ago
// 通过ID查找名称
findNameById(array, express_id) {
const result = array.find((item) => item.express_id === express_id);
return result.express_name;
},
9 months ago
onLogistics() {
uni.navigateTo({
9 months ago
url: "/pages/news3/LogisticsDetails?logisticsNum=" + this.form.express_no
9 months ago
})
},
onRemoveTransfer(index) {
this.transferList.splice(index, 1)
},
onRemoveChat(index) {
this.chatList.splice(index, 1)
},
9 months ago
//接受上传返回的数据
transferSuccess(list) {
let nList = []
list.forEach(item => {
if (item.response) {
nList.push(item)
}
});
list = nList
9 months ago
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
uni.showToast({
title: "上传成功"
})
this.handleList = []
list.forEach(item => {
this.handleList.push(item.response.data.fileInfo)
});
}
9 months ago
}
},
//接受上传返回的数据
chatSuccess(list) {
let nList = []
list.forEach(item => {
if (item.response) {
nList.push(item)
}
});
list = nList
9 months ago
if (list.length > 0) {
const {
response
} = list[0];
if (response.status == 200) {
9 months ago
uni.showToast({
title: "上传成功"
})
this.handChatList = []
9 months ago
list.forEach(item => {
this.handChatList.push(item.response.data.fileInfo)
9 months ago
});
}
}
},
9 months ago
}
10 months ago
}
</script>
<style lang="scss" scoped>
9 months ago
page {
min-height: 100%;
background-color: #F7F8FA;
10 months ago
}
9 months ago
.selectContent {
border-top: 1px solid transparent;
margin-top: 6upx;
padding: 0 40upx !important;
9 months ago
}
::v-deep .u-border-bottom:after {
border: none;
}
::v-deep .u-field {
padding: 20upx 0 !important;
9 months ago
}
::v-deep .uni-input-wrapper {
text-align: right;
}
::v-deep .u-label {
flex: auto !important
}
9 months ago
::v-deep .u-flex-1 {
width: 360upx !important;
text-align: right !important;
color: #B0B0B0 !important;
margin: 0 !important;
9 months ago
}
9 months ago
.wuliu {
display: flex;
align-items: center;
9 months ago
.fanfan {
padding-right: 0 !important;
}
9 months ago
.getWuliu {
width: 130upx;
height: 56upx;
background: #FFFFFF;
border-radius: 19px 19px 19px 19px;
opacity: 1;
border: 1px solid #F55349;
font-size: 24upx;
10 months ago
font-family: PingFang SC, PingFang SC;
font-weight: 400;
9 months ago
color: #F55349;
line-height: 52upx;
10 months ago
text-align: center;
margin-left: 10upx;
9 months ago
}
}
.recordList {
padding: 0 0 30upx 0;
9 months ago
.recordItem {
.recordTitle {
9 months ago
margin-bottom: 10upx;
9 months ago
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
color: #353535;
}
.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 {
width: 86%;
height: 88upx;
background: #FF5050;
border-radius: 36px 36px 36px 36px;
opacity: 1;
font-size: 28upx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
color: #FFFFFF;
line-height: 88upx;
text-align: center;
margin: 42upx auto 0 auto;
9 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;
}
}
}
9 months ago
</style>