|
@@ -0,0 +1,362 @@
|
|
|
+<template>
|
|
|
+ <view class="content">
|
|
|
+ <view class="box">
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">招商经理</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="text" v-model="userInfo.name" placeholder="" disabled class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">门店名称</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="text" v-model="value.shopName" placeholder="请输入" class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">门店地址</view>
|
|
|
+ <view class="lineRight ">
|
|
|
+ <picker @change="bindChange" mode="region" >
|
|
|
+ <view class="lineAddress ">{{shopaddress == null ? '请选择' :shopaddress}}
|
|
|
+ <image class="downArrow" src="../../static/img/jiantou.png"></image>
|
|
|
+ </view>
|
|
|
+ </picker>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">详细地址</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="text" v-model="value.address" placeholder="请输入" class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">联系人</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="text" v-model="value.contactor" placeholder="请输入" class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">联系方式</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="number" v-model="value.contactorPhone" placeholder="请输入" class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">工位数量</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="number" v-model="value.stationNum" placeholder="请输入" class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="line2">
|
|
|
+ <view class="lineLeft">门头照片</view>
|
|
|
+ <view class="lineRight2">
|
|
|
+ <view class="imgLine2" >
|
|
|
+ <view class="imgLine" v-for="(img,imgindex) in imgArr" :class="{img4:(imgindex+1)%4==0}">
|
|
|
+ <image @click="previewImage(img,item.imgArr)" :src="img" mode="" class="itemImg"></image>
|
|
|
+ <image src="../../static/img/icon_delpic@2x.png" mode="" class="delImg" @click="delimg(item,imgindex)"></image>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ <image @click="uploadImg" src="../../static/img/icon_addpic@2x.png" mode="" class="itemImg" style="margin-right: 0;"></image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="line">
|
|
|
+ <view class="lineLeft">备注</view>
|
|
|
+ <view class="lineRight">
|
|
|
+ <input type="text" v-model="value.description" placeholder="请输入" class="lineInput"/>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view style="height: 126rpx;"></view>
|
|
|
+ <view class="bottom">
|
|
|
+ <view class="bottomBtn" @click="addIntendedShop">提交</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ userInfo:'',
|
|
|
+ value:{
|
|
|
+ id:'',
|
|
|
+ shopName:'',
|
|
|
+ province:'',
|
|
|
+ city:'',
|
|
|
+ area:'',
|
|
|
+ cityName:'',
|
|
|
+ areaName:'',
|
|
|
+ address:'',
|
|
|
+ contactor:'',
|
|
|
+ contactorPhone:'',
|
|
|
+ managerID:'',
|
|
|
+ managerName:'',
|
|
|
+ stationNum:'',
|
|
|
+ description:'',
|
|
|
+ imgs:'',
|
|
|
+ },
|
|
|
+ imgArr:[],
|
|
|
+ shopaddress:null,
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ onLoad() {
|
|
|
+ this.$common.isUserId()
|
|
|
+ this.userInfo = uni.getStorageSync("userInfo");
|
|
|
+ this.value.managerID=this.userInfo.id;
|
|
|
+ this.value.managerName=this.userInfo.name;
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ addIntendedShop(){
|
|
|
+
|
|
|
+ if(!this.value.shopName){
|
|
|
+ uni.showToast({ title: '请填写门店名称',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }else if(!this.value.province){
|
|
|
+ uni.showToast({title: '请选择门店地址',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }else if(!this.value.address){
|
|
|
+ uni.showToast({title: '请填写详细地址',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }else if(!this.value.contactor){
|
|
|
+ uni.showToast({title: '请填写联系人',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }else if(!this.value.contactorPhone){
|
|
|
+ uni.showToast({title: '请填写联系方式',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }else if(!this.value.stationNum){
|
|
|
+ uni.showToast({title: '请填写工位数量',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }else if(this.imgArr.length==0){
|
|
|
+ uni.showToast({title: '请上传门头照片',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if(/[^\d]/g.test(this.value.stationNum)) {
|
|
|
+ uni.showToast({title: '工位数量只能为整数',icon:'none',duration: 2000,});
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(!(/^1[34578]\d{9}$/.test(this.value.contactorPhone))){
|
|
|
+ uni.showToast({title: '联系方式有误,请重填',icon:'none',duration: 2000,});
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ this.value.imgs=this.imgArr.join(',')
|
|
|
+ this.$http('accompany/superIntendedShop/addIntendedShop',
|
|
|
+ this.value
|
|
|
+ , 'POST').then(res => {
|
|
|
+ if(res.code==0){
|
|
|
+ uni.showToast({
|
|
|
+ title: '提交成功',
|
|
|
+ icon:'success',
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ setTimeout(function(){
|
|
|
+ uni.navigateBack({
|
|
|
+ delta:1
|
|
|
+ })
|
|
|
+ },1000)
|
|
|
+ }else{
|
|
|
+ uni.showToast({ title: '操作失误',icon:'none',duration: 2000,});
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ bindChange: function(e) {
|
|
|
+ console.log(e)
|
|
|
+ this.shopaddress=e.detail.value[0]+e.detail.value[1]+e.detail.value[2];
|
|
|
+ this.value.province=e.detail.code[0];
|
|
|
+ this.value.city=e.detail.code[1];
|
|
|
+ this.value.area=e.detail.code[2];
|
|
|
+ this.value.provinceName=e.detail.value[0];
|
|
|
+ this.value.cityName=e.detail.value[1];
|
|
|
+ this.value.areaName=e.detail.value[2];
|
|
|
+ },
|
|
|
+ uploadImg(){
|
|
|
+ var that=this;
|
|
|
+ var length=this.imgArr.length;
|
|
|
+ if(length>8){
|
|
|
+ uni.showToast({
|
|
|
+ title: '最多上传9张',
|
|
|
+ icon:'none',
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ var num=9;
|
|
|
+ uni.chooseImage({
|
|
|
+ sourceType: ['album','camera'],
|
|
|
+ count:num-length,
|
|
|
+ success: (chooseImageRes) => {
|
|
|
+ const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
|
+ /* tempFilePaths.forEach(v=>{
|
|
|
+ uni.uploadFile({
|
|
|
+ url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile', //仅为示例,非真实的接口地址
|
|
|
+ filePath: v,
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ 'user': 'test'
|
|
|
+ },
|
|
|
+ success: (uploadFileRes) => {
|
|
|
+ console.log(JSON.parse(uploadFileRes.data).data[0] );
|
|
|
+
|
|
|
+ var i= JSON.parse(uploadFileRes.data).data[0]
|
|
|
+
|
|
|
+ this.imgArr.push(i)
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }) */
|
|
|
+ tempFilePaths.forEach(v => {
|
|
|
+
|
|
|
+ uni.uploadFile({
|
|
|
+ url: that.$request.baseUrl+'accompany/SuperCheckSheet/uploadFile',
|
|
|
+ filePath: v,
|
|
|
+ name: 'file',
|
|
|
+ formData: {
|
|
|
+ 'user': 'test'
|
|
|
+ },
|
|
|
+
|
|
|
+ success: (uploadFileRes) => {
|
|
|
+
|
|
|
+ console.log(JSON.parse(uploadFileRes.data).data);
|
|
|
+ that.imgArr = that.imgArr.concat(JSON.parse(
|
|
|
+ uploadFileRes.data).data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+
|
|
|
+ /* that.$http('accompany/SuperCheckSheet/uploadFile', tempFilePaths[0], 'POST').then(res => {
|
|
|
+
|
|
|
+ }) */
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ previewImage(img,arr){
|
|
|
+ //var arr=[];
|
|
|
+ //arr.push(img)
|
|
|
+ // 预览图片
|
|
|
+ uni.previewImage({
|
|
|
+ urls: arr,
|
|
|
+ current:img,
|
|
|
+ longPressActions: {
|
|
|
+ itemList: ['发送给朋友', '保存图片', '收藏'],
|
|
|
+ success: function(data) {
|
|
|
+ console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ console.log(err.errMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ delimg(item,imgindex){
|
|
|
+ this.imgArr.splice(imgindex,1);
|
|
|
+
|
|
|
+ },
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+ .content{
|
|
|
+ min-height: 100vh;
|
|
|
+ background-color: #F4F5F7;
|
|
|
+ }
|
|
|
+ .box{
|
|
|
+ padding-top: 20rpx;
|
|
|
+ }
|
|
|
+ .line{
|
|
|
+ display: flex;
|
|
|
+ background: #FFFFFF;
|
|
|
+ padding: 30rpx 24rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ line-height: 48rpx;
|
|
|
+ color: #3C3C3C;
|
|
|
+ border-bottom: 1px solid #EEEEEE;
|
|
|
+ }
|
|
|
+ .lineLeft{
|
|
|
+ width: 200rpx;
|
|
|
+ }
|
|
|
+ .lineInput{
|
|
|
+ width: 500rpx;
|
|
|
+ height: 48rpx;
|
|
|
+ line-height: 48rpx;
|
|
|
+ }
|
|
|
+ .downArrow{
|
|
|
+ width: 14rpx;
|
|
|
+ height: 26rpx;
|
|
|
+ margin-top: 8rpx;
|
|
|
+ }
|
|
|
+ .lineAddress{
|
|
|
+ width: 500rpx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ }
|
|
|
+ .line2{
|
|
|
+
|
|
|
+ background: #FFFFFF;
|
|
|
+ padding: 30rpx 24rpx;
|
|
|
+ font-size: 28rpx;
|
|
|
+ line-height: 48rpx;
|
|
|
+ color: #3C3C3C;
|
|
|
+ border-bottom: 1px solid #EEEEEE;
|
|
|
+ }
|
|
|
+ .itemImg{
|
|
|
+ width:150rpx;
|
|
|
+ height: 150rpx;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ .delImg{
|
|
|
+ width: 32rpx;
|
|
|
+ height: 32rpx;
|
|
|
+ position: absolute;
|
|
|
+ right:-20rpx;
|
|
|
+ top: -20rpx;
|
|
|
+ z-index: 11;
|
|
|
+ }
|
|
|
+ .imgLine{
|
|
|
+ position: relative;
|
|
|
+ width: 150rpx;
|
|
|
+ height: 150rpx;
|
|
|
+ background: #F4F5F7;
|
|
|
+ border-radius: 10rpx;
|
|
|
+ display: flex;
|
|
|
+ margin-right: 20rpx;
|
|
|
+ }
|
|
|
+ .imgLine2{
|
|
|
+ padding-top: 20rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ }
|
|
|
+ .img4{
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
+ .bottom{
|
|
|
+ width: 750rpx;
|
|
|
+ height: 120rpx;
|
|
|
+ background: #FFFFFF;
|
|
|
+ box-shadow: 0px -4px 8px 0px rgba(153,153,153,0.08);
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ }
|
|
|
+ .bottomBtn{
|
|
|
+ width: 702rpx;
|
|
|
+ height: 74rpx;
|
|
|
+ background: linear-gradient(124deg, #FF8700 0%, #FF4F00 100%);
|
|
|
+ border-radius: 37rpx;
|
|
|
+ line-height: 74rpx;
|
|
|
+ text-align: center;
|
|
|
+ color: #FFFFFF;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-top: 24rpx;
|
|
|
+ margin-left: 24rpx;
|
|
|
+
|
|
|
+ }
|
|
|
+</style>
|