耀实惠小程序
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.
 
 
 

243 lines
5.1 KiB

<template>
<view>
<text class="title">代购需求</text>
<textarea class="word_box" v-model="need" maxlength="400" name="" id="" cols="30" rows="10" placeholder="请输入药品名称......."></textarea>
<view class="pic_title">
<text class="title">代购需求</text>
<text class="info">(*需上传代购药品的图片)</text>
</view>
<view class="pic_box">
<u-upload ref="uUpload"
:header="headerInfo"
:action="upload_img"
:custom-btn="true"
image-mode="none"
@on-success="onSuccess"
@on-remove= "close"
max-count="6" width="180" height="180" >
<view slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
<image :src="img_url+'upLoad.png'" mode=""></image>
</view>
</u-upload>
</view>
<button class="sbmt_btn" @click="submit">提交</button>
<view class="buttom_btn">
<text class="title">联系我们</text>
<view class="card">
<button open-type="contact" bindcontact="handleContact" session-from="sessionFrom" class="wechatBtn">
<image :src=" img_url + 'leave_word/wechat.png'" mode=""></image>
</button>
<image @click="toPhone" :src=" img_url + 'leave_word/phone.png'" mode=""></image>
</view>
</view>
</view>
</template>
<script>
import config_img from "@/utils/js/config.js";
export default {
data() {
return {
img_url: config_img.img_url,
upload_img: '',
href: 'api/info/upload',
headerInfo: {
"content-type": "application/x-www-form-urlencoded",
"X-Access-Token": ''
},
need: "",
fileList1:[],
user_info: {},
upImg: ''
}
},
onLoad() {
let token = uni.getStorageSync("__user_token");
this.headerInfo['X-Access-Token'] = token;
this.upload_img = this.$upload_img;
this.getUserInfo();
},
methods: {
// 获取个人信息
getUserInfo () {
new Promise((resolve, reject) => {
this.$api('getUserInfo')
.then(res => {
let { code, result, message } = res
if (code === 200) {
console.log(result)
this.sex = res.result.userInfo.sex == null ? "保密" : res.result.userInfo.sex
this.user_info= res.result.userInfo;
uni.hideLoading();
// this.noticeList = result.map(item => item.title)
resolve()
} else {
reject(message)
uni.hideLoading();
}
})
.catch(err => {
reject(err.message)
})
})
},
onSuccess(data) {
console.log(data)
this.upImg = data.result
},
submit() {
if(this.need == '') {
this.$Toast('请输入代购药品名称')
return
}
if(this.image == '') {
this.$Toast('请上传代购药品图片')
return
}
const params = {
concert: this.need,
createBy: this.user_info,
image: this.upImg
};
new Promise((resolve, reject) => {
this.$api('setPurchasingAgency', params)
.then(res => {
let { code, result, message } = res
if (code === 200) {
console.log(result)
// this.$refs.uUpload.remove(0);
this.$Toast(message);
// 跳转
setTimeout(() => {
uni.redirectTo({
url: "./succee/index"
})
},1500)
// this.noticeList = result.map(item => item.title)
resolve()
} else {
this.$Toast(message);
reject(message)
uni.hideLoading();
}
})
.catch(err => {
this.$Toast(message);
reject(err.message)
})
})
},
// 电话咨询
toPhone() {},
close(res) {
console.log(res)
this.upImg = ""
}
}
}
</script>
<style lang="scss" scoped>
.wechatBtn {
background: transparent;
border: 0;
&::after{
background: transparent;
border: 0;
}
}
.pic_box {
display: flex;
align-items: center;
/deep/.u-list-item {
margin: 0;
width: 180rpx !important;
height: 180rpx !important;
border-radius: 12rpx;
margin: 15rpx 30rpx;
.u-preview-image{
width: 160rpx;
height: 160rpx;
}
image {
width: 180rpx;
height: 180rpx;
border-radius: 15rpx;
}
.u-delete-icon{
top: 0;
right: 0;
}
}
image {
width: 180rpx;
height: 180rpx;
margin: 15rpx 30rpx;
border-radius: 15rpx;
}
}
.title{
display: inline-block;
padding-top: 15rpx;
margin-left: 31rpx;
font-size: 36rpx;
}
.word_box{
width: 684rpx;
font-size: 32rpx;
margin-top: 20rpx;
margin-left: 33rpx;
margin-right: 33rpx;
}
.pic_title{
.title{
display: inline-block;
font-size: 36rpx;
padding-top: 15rpx;
margin-left: 31rpx;
}
.info{
font-size: 30rpx;
color: #707070;
}
}
.sbmt_btn{
width: 668rpx;
height: 88rpx;
margin: 0 auto;
border-radius: 38rpx;
background-color: #01AEEA;
line-height: 88rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
margin-top: 100rpx;
}
.buttom_btn{
width: 100%;
.title{
display: inline-block;
font-size: 32rpx;
color: #000;
margin-top: 74rpx;
margin-left: 42rpx;
}
.card{
margin-top: 48rpx;
margin-left: 25rpx;
margin-right: 25rpx;
display: flex;
justify-content: space-between;
image{
width: 331rpx;
height: 133rpx;
border-radius: 12rpx;
}
}
}
</style>