demingshangjia/pages/index/mention.vue

148 lines
4.2 KiB
Vue
Raw Normal View History

2020-09-02 06:05:08 +00:00
<template>
<view class="container">
<view class="upload">
<view class="title">
<text>上传凭证</text>
<text class="tips">仅可上传1张凭证</text>
</view>
2020-09-03 02:26:55 +00:00
<u-upload class="upload-box" :form-data="coverformdata" upload-text="" :action="action" :header="header" name="common" :max-count="1" @on-success="uploadSuc"></u-upload>
2020-09-02 06:05:08 +00:00
</view>
<view class="remarks">
<view>备注:</view>
<textarea class="textarea-box" v-model="textareaVal" placeholder="请输入内容..." placeholder-class="placeholder-style" />
</view>
<u-button class="btn-submit" @click="submitInfo">提交</u-button>
<u-toast ref="uToast" />
</view>
</template>
<script>
export default {
data() {
return {
header: {
Authorization: 'Bearer' + ' ' + uni.getStorageSync('token')
},
action: "https://mall.dmygkeji.com/api/Upload/uploadfile",
coverformdata: {
name: 'common'
},
img_url: "", // 图片路径
textareaVal: "", // 备注
};
},
onLoad(option) {
// console.log(option);
this.order_id = option.id;
},
methods: {
// 上传成功
uploadSuc(e) {
if (e.errCode == 0) {
this.$refs.uToast.show({
title: e.message,
type: "success"
})
2020-09-03 02:26:55 +00:00
// console.log(e.data);
2020-09-02 06:05:08 +00:00
this.img_url = e.data.file_path;
} else {
this.$refs.uToast.show({
title: e.message,
})
}
},
// 自提提交
submitInfo() {
if (!this.img_url) {
this.$refs.uToast.show({
title: "请上传凭证!",
type: "warning"
})
return;
}
if (!this.$u.trim(this.textareaVal)) {
this.$refs.uToast.show({
title: "请填写备注!",
type: "warning"
})
return;
}
// 提交
this.$u.api.bindmention({
2020-09-10 01:20:30 +00:00
store_deliver_type: 3,
2020-09-02 06:05:08 +00:00
shipping_express_id: "e1000",
deliver_explain: this.textareaVal,
order_id: this.order_id,
sendimg: this.img_url,
}).then(res => {
console.log(res);
if (res.errCode == 0) {
this.$refs.uToast.show({
title: res.message,
type: "success",
2020-09-03 02:26:55 +00:00
isTab: "true",
2020-09-02 06:05:08 +00:00
url: "/pages/index/index"
})
} else {
this.$refs.uToast.show({
title: res.message,
type: "warning"
})
}
})
}
}
}
</script>
<style lang="scss">
.container {
padding: 30rpx;
}
2020-09-03 02:26:55 +00:00
::v-deep.uicon-plus {
font-size: 50rpx !important;
}
2020-09-02 06:05:08 +00:00
.upload {
.title {
display: flex;
align-items: center;
font-size: 30rpx;
font-weight: 400;
color: #333;
.tips {
font-size: 20rpx;
color: #999;
}
}
.upload-box {
margin: 20rpx 0;
}
}
.remarks {
.textarea-box {
width: calc(100% - 42rpx);
padding: 20rpx;
margin-top: 20rpx;
font-size: 28rpx;
color: #333;
border-radius: 10rpx;
border: 1px solid #BABABA;
}
.placeholder-style {
color: #999;
font-size: 26rpx;
}
}
.btn-submit {
width: 690rpx;
2020-09-03 02:26:55 +00:00
height: 98rpx !important;
2020-09-02 06:05:08 +00:00
margin-top: 70rpx;
2020-09-03 02:26:55 +00:00
font-size: 36rpx !important;
text-align: center;
line-height: 98rpx !important;
color: #fff !important;
2020-09-02 06:05:08 +00:00
border-radius: 50rpx;
2020-09-03 02:26:55 +00:00
background-color: #FF780F !important;
2020-09-02 06:05:08 +00:00
}
</style>