cmy 1 سال پیش
والد
کامیت
b35e6cd6f5
3فایلهای تغییر یافته به همراه167 افزوده شده و 83 حذف شده
  1. 11 0
      api/shop.js
  2. 4 4
      manifest.json
  3. 152 79
      pages/shop/becomeShop.vue

+ 11 - 0
api/shop.js

@@ -0,0 +1,11 @@
+import request from "@/utils/request.js";
+export function apply(data) {
+	return request.post('user',data);
+}
+export function gettype() {
+	return request.get('merchant_intention/getType');
+}
+export function getclassify() {
+	return request.get('merchant_intention/getCategory');
+}
+

+ 4 - 4
manifest.json

@@ -217,15 +217,15 @@
         "devServer" : {
             "proxy" : {
                 "/api" : {
-                    "target" : "https://www.psgjsc.com", //请求的目标域名
-
-                    // "target" : "http://myc.frp.liuniu946.com/api", //请求的目标域名
+                    // "target" : "https://www.psgjsc.com", //请求的目标域名
+                    "target" : "http://paishang.frp.liuniu946.com", //请求的目标域名
                     "changeOrigin" : true,
                     // "secure": false,
                     "pathRewrite" : {}
                 }
             },
-            "https" : true
+            "https" : true,
+            "port" : 8888
         },
         "router" : {
             "mode" : "history",

+ 152 - 79
pages/shop/becomeShop.vue

@@ -17,13 +17,50 @@
 					<view class="item-left">店铺名称:</view>
 					<view class="item-right"><input type="text" placeholder="请输入店铺名" v-model="name" /></view>
 				</view>
-				<view class="box-item" @click="getLocation">
+				<!-- <view class="box-item" @click="getLocation"> -->
+				<view class="box-item">
 					<view class="item-left">商家地址:</view>
-					<view class="item-right"><input type="text" placeholder="请选择详细地址" v-model="showaddress" /></view>
+					<view class="item-right">
+						<input type="text" placeholder="请填写详细地址" v-model="showaddress" />
+					</view>
+				</view>
+				<view class="box-item">
+					<view class="item-left">商户类型:</view>
+					<view class="item-right">
+						<picker mode="selector" :range="typeList" range-key='type_name' @change="changeType">
+							<view>{{type.type_name}}</view>
+						</picker>
+					</view>
+				</view>
+				<view class="box-item">
+					<view class="item-left">店铺类型:</view>
+					<view class="item-right"><picker mode="selector" :range="classifyList" range-key='category_name' @change="changeClassify">
+							<view>{{classify.category_name}}</view>
+						</picker></view>
+				</view>
+			</view>
+			<view class="enterprise-box">
+				<view class="box-item">
+					<view class="item-left">身份证:</view>
+					<view class="item-right"><input type="text" placeholder="请输入身份证" v-model="Idcard" /></view>
+				</view>
+				<view class="box-item">
+					<view class="item-left">店铺简介:</view>
+					<view class="item-right"><input type="text" placeholder="请输入店铺简介" v-model="introductory" /></view>
+				</view>
+			</view>
+			<view class="enterprise-box">
+				<view class="box-item">
+					<view class="item-left">商户账号:</view>
+					<view class="item-right"><input type="text" placeholder="请输入商户账号" v-model="account" /></view>
+				</view>
+				<view class="box-item">
+					<view class="item-left">商户密码:</view>
+					<view class="item-right"><input type="password" placeholder="请输入商户密码" v-model="pwd" /></view>
 				</view>
 				<view class="box-item">
-					<view class="item-left">服务类目:</view>
-					<view class="item-right"><input type="text" placeholder="请输入您的经营范围" v-model="introduction" /></view>
+					<view class="item-left">重复密码:</view>
+					<view class="item-right"><input type="password" placeholder="请重复输入商户密码" v-model="pwdRs" /></view>
 				</view>
 			</view>
 			
@@ -31,21 +68,21 @@
 				<view class="box-item1">
 					<view class="item-left">商户门头:</view>
 					<view class="item-right">
-						<image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub" v-if="cardimg"></image>
+						<image :src="cardimg" mode="" class="upload-img" @click.stop="imgsub('cardimg')" v-if="cardimg"></image>
 						<image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!cardimg" @click.stop="imgsub"></image>
 					</view>
 				</view>
 			</view>
 			<view class="enterprise-box">
 				<view class="box-item1">
-					<view class="item-left">营业执照:</view>
+					<view class="item-left">商户logo:</view>
 					<view class="item-right">
-						<image :src="imgY" mode="" class="upload-img" @click.stop="imgsubY" v-if="imgY"></image>
+						<image :src="imgY" mode="" class="upload-img" @click.stop="imgsub('imgsubY')" v-if="imgY"></image>
 						<image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!imgY" @click.stop="imgsubY"></image>
 					</view>
 				</view>
 			</view>
-			<view class="enterprise-box">
+			<!-- <view class="enterprise-box">
 				<view class="box-item">
 					<view class="item-left">环境介绍:</view>
 					<view class="item-right"><input type="text" placeholder="请输入" v-model="introductory" /></view>
@@ -53,15 +90,14 @@
 				<view class="box-item1">
 					<view class="item-left">店内照片:</view>
 					<view class="item-right">
-						<image :src="shopImg" mode="" class="upload-img" @click.stop="imgsub" v-if="shopImg"></image>
+						<image :src="shopImg" mode="" class="upload-img" @click.stop="imgsub('imgsub')" v-if="shopImg"></image>
 						<image src="../../static/images/up-img.png" class="upload-img" mode="" v-if="!shopImg" @click.stop="imgsut"></image>
 					</view>
 				</view>
-			</view>
+			</view> -->
 		</view>
-		<view class="flex">
+		<!-- <view class="flex">
 			<view class="">
-				
 			</view>
 			<view class="">
 				我已阅读并同意
@@ -69,18 +105,18 @@
 			<view class="shopDetail">
 			《商户入驻协议》
 			</view>
-		</view>
-		
-		
-		
+		</view> -->
 		<view class="comfirm" @click="comfirm">提交申请</view>
+		<canvas canvas-id="canvas" v-if="canvasStatus"
+			:style="{width: canvasWidth + 'px', height: canvasHeight + 'px',position: 'absolute',left:'-100000px',top:'-100000px'}"></canvas>
 	</view>
 </template>
 
 <script>
 // import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
 import { mapState, mapMutations } from 'vuex';
-import { upload, apply } from '@/api/order.js';
+import { upload } from '@/api/order.js';
+import { apply,gettype,getclassify } from '@/api/shop.js';
 export default {
 	// components: {
 	// 	pickerAddress
@@ -90,25 +126,56 @@ export default {
 	},
 	data() {
 		return {
-			imgY: '', //营业执照
+			classify:{category_name:'请选择店铺类型'},//选择的商户分类
+			classifyList:[],//商户分类列表
+			type:{type_name:'请选择商户类型'},//选择的商户类型
+			typeList:[],//商户类型列表
+			imgY: '', //商户logo
 			checked: false,
 			name: '', //店铺名
-			telphone: '', //商家电话
-			introduction: '', //主营项目
 			introductory: '', //简介
 			Idcard: '', //身份证号码
-			spared: '', //推荐人
 			nameP: '', //联系人
 			phone: '', //联系人电话
 			showaddress: '', //详细地址
-			addressDetail: '', //省市区
-			cardimg: '', //店铺logo
-			latitude: '',
-			longitude: '',
-			shopImg:''//店内图片
+			// addressDetail: '', //省市区
+			cardimg: '', //商户门头
+			// latitude: '',
+			// longitude: '',
+			account:'',//商户账号
+			pwd:'',//商户密码
+			canvasStatus:false,
+			canvasWidth:'',
+			canvasHeight:'',
+			pwdRs:''
 		};
 	},
+	onShow() {
+		this.getType();
+		this.getClassify();
+	},
 	methods: {
+		// 获取商户分类列表
+		getType(){
+			gettype().then(({data}) =>{
+				this.typeList = data
+			})
+		},
+		// 获取店铺类型列表
+		getClassify() {
+			getclassify().then(({data}) =>{
+				this.classifyList = data
+			})
+		},
+		changeClassify(e) {
+			let i = e.detail.value
+			this.classify = this.classifyList[i]
+			console.log(this.classify ,'123');
+		},
+		changeType(e) {
+			let i = e.detail.value
+			this.type = this.typeList[i]
+		},
 		// 上传门内图片
 		imgsut() {
 			// console.log('上传logo');
@@ -120,14 +187,19 @@ export default {
 			});
 		},
 		// 上传门店logo图片
-		imgsub() {
+		imgsub(image) {
 			// console.log('上传logo');
-			upload({
-				filename: ''
-			}).then(data => {
-				console.log('data', data);
-				this.cardimg = data[0].url;
-			});
+				let that = this;
+				this.canvasStatus = true
+				that.$util.uploadImageChange('upload/image', function(res) {
+					that[image] = res.data.url;
+					console.log(that[image]);
+				}, (res) => {
+					this.canvasStatus = false
+				}, (res) => {
+					this.canvasWidth = res.w
+					this.canvasHeight = res.h
+				});
 		},
 		// 上传营业执照图片
 		imgsubY() {
@@ -141,26 +213,21 @@ export default {
 		check() {
 			this.checked = !this.checked;
 		},
-		getLocation() {
-			console.log('选择当前位置');
-			let obj = this;
-			uni.chooseLocation({
-				success: function(res) {
-					console.log('1111:' + res);
-					console.log('位置名称:' + res.name);
-					console.log('详细地址:' + res.address);
-					console.log('纬度:' + res.latitude);
-					console.log('经度:' + res.longitude);
-					obj.latitude = res.latitude;
-					obj.longitude = res.longitude;
-					if (res.address) {
-						obj.showaddress = res.address;
-					} else {
-						obj.showaddress = res.name;
-					}
-				}
-			});
-		},
+		// getLocation() {
+		// 	console.log('选择当前位置');
+		// 	let obj = this;
+		// 	uni.chooseLocation({
+		// 		success: function(res) {
+		// 			obj.latitude = res.latitude;
+		// 			obj.longitude = res.longitude;
+		// 			if (res.address) {
+		// 				obj.showaddress = res.address;
+		// 			} else {
+		// 				obj.showaddress = res.name;
+		// 			}
+		// 		}
+		// 	});
+		// },
 		// 选中城市切换
 		onCityClick({ data }) {
 			this.addressDetail = data.join(',');
@@ -172,23 +239,18 @@ export default {
 				obj.$api.msg('请输入店铺名');
 				return;
 			}
-			const reg1 = /^(\+?0?86-?)?1[\d]\d{9}$/;
-			if (!reg1.test(obj.telphone)) {
-				obj.$api.msg('请输入商家电话');
+			if (obj.classify.category_name == '请选择店铺类型') {
+				obj.$api.msg('请选择店铺类型');
 				return;
 			}
-			if (obj.introduction == '') {
-				obj.$api.msg('请输入您的主营项目');
+			if (obj.type.type_name == '请选择商户类型') {
+				obj.$api.msg('请选择商户类型');
 				return;
 			}
 			if (obj.introductory == '') {
 				obj.$api.msg('请输入您的商铺简介');
 				return;
 			}
-			if (obj.spared == '') {
-				obj.$api.msg('请输入您的推荐人');
-				return;
-			}
 			if (obj.Idcard == '') {
 				obj.$api.msg('请输入身份证号');
 				return;
@@ -197,36 +259,47 @@ export default {
 				obj.$api.msg('请输入联系人');
 				return;
 			}
-			if (obj.adress == '') {
-				obj.$api.msg('请选择详细地址');
+			if (obj.phone == '') {
+				obj.$api.msg('请输入联系人电话');
 				return;
 			}
-			if (obj.addressDetail == '') {
-				obj.$api.msg('请选择省市区');
+			if (obj.showaddress == '') {
+				obj.$api.msg('请选择详细地址');
 				return;
 			}
 			if (obj.cardimg == '') {
-				obj.$api.msg('请上传店铺LOGO');
+				obj.$api.msg('请上传门头照片');
 				return;
 			}
 			if (obj.imgY == '') {
 				obj.$api.msg('请上传营业执照');
 				return;
 			}
+			if (obj.account == '') {
+				obj.$api.msg('请填写商户账号');
+				return;
+			}
+			if (obj.pwd == '') {
+				obj.$api.msg('请填写商户密码');
+				return;
+			}
+			if(obj.pwd!=obj.pwdRs){
+				obj.$api.msg('重复密码输入不相同请重新输入');
+				return;
+			}
 			apply({
-				name: obj.name,
+				mer_name: obj.name,
+				category_id: obj.classify.merchant_category_id,
+				type_id:obj.type.mer_type_id,
+				name:obj.nameP,
+				account:obj.account,
+				pwd:obj.pwd,
+				phone:obj.phone,
+				mer_address:obj.showaddress,
+				Idcard:obj.Idcard,
 				introduction: obj.introductory,
-				phone: obj.telphone,
-				address: obj.addressDetail,
-				detailed_address: obj.showaddress,
-				image: obj.cardimg,
-				latitude: obj.latitude,
-				longitude: obj.longitude,
-				leader: obj.nameP,
-				id_card: obj.Idcard,
-				job: obj.introduction,
-				cert: obj.imgY,
-				spread_uid: obj.spared
+				image:obj.imgY,
+				shopImg:obj.shopImg
 			})
 				.then(e => {
 					uni.showToast({