zhangdan 4 years ago
parent
commit
9e4e5ffd7e
5 changed files with 163 additions and 33 deletions
  1. 3 3
      App.vue
  2. 31 0
      api/shop.js
  3. 8 3
      pages/index/index.vue
  4. 85 16
      pages/store/addStore.vue
  5. 36 11
      pages/store/storeList.vue

+ 3 - 3
App.vue

@@ -1,10 +1,10 @@
 <script>
 <script>
-	const uat_domain = 'https://rider.test.sxzxyj.net' // 预发布
-	// const uat_domain = 'http://192.168.16.103:8309' // 本地
+	// const uat_domain = 'https://rider.test.sxzxyj.net' // 预发布
+	const uat_domain = 'http://192.168.16.213:8309' // 本地
 	const pro_domain = 'https://rider.sxzxyj.net' // 生产
 	const pro_domain = 'https://rider.sxzxyj.net' // 生产
 	const uat_URL = uat_domain+'/gc-rider/' // 预发布
 	const uat_URL = uat_domain+'/gc-rider/' // 预发布
 	const pro_URL = pro_domain+'/gc-rider/'  // 生产
 	const pro_URL = pro_domain+'/gc-rider/'  // 生产
-	const buildType = 1 // 打包环境对应类型,1 生产 0 预发布
+	const buildType = 0 // 打包环境对应类型,1 生产 0 预发布
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
 	const buildURL = buildType ? pro_URL : uat_URL // 打包后实际对应的url
 	const envText = ['预发布环境','生产环境']
 	const envText = ['预发布环境','生产环境']
 	const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]
 	const envTips = process.env.NODE_ENV == 'development' ? envText[0] : envText[buildType]

+ 31 - 0
api/shop.js

@@ -0,0 +1,31 @@
+import axios from '@/libs/axios.js'
+// 历史记录预约单列表
+export const shopList = (params) => {
+	let url = `/customer/reserve/queryPage/${params.pageNo}/${params.pageSize}`
+	delete params.pageNo
+	delete params.pageSize
+  return axios.request({
+    url: url,
+    method: 'post',
+	data:params
+  })
+}
+
+// 新增/编辑保存商铺接口
+export const savShop = params => {
+  return axios.request({
+    url: '/customer/reserve/save',
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 查询商铺详情
+export const shopDetails = (params) => {
+  const url = `/customer/reserve/findById/${params.id}`
+  return axios.request({
+    url: url,
+    data: {},
+    method: 'get'
+  })
+}

+ 8 - 3
pages/index/index.vue

@@ -291,9 +291,14 @@
 			},
 			},
 			// 打开回收价格页面
 			// 打开回收价格页面
 			openPrice() {
 			openPrice() {
-				uni.navigateTo({
-					url: '/pages/recoveryPrice/index'
-				})
+				if(this.hasLogin){
+					uni.navigateTo({
+						url: '/pages/recoveryPrice/index'
+					})
+				}else{
+					this.loginModal()
+				}
+				
 			},
 			},
 			// 进入待处理订单详情
 			// 进入待处理订单详情
 			intoWaitOrderDetail(item) {
 			intoWaitOrderDetail(item) {

+ 85 - 16
pages/store/addStore.vue

@@ -5,7 +5,7 @@
 				<view class="flex flex_column data-item">
 				<view class="flex flex_column data-item">
 					<text>名称</text>
 					<text>名称</text>
 					<view class="list-item-right flex_1 flex justify_between">
 					<view class="list-item-right flex_1 flex justify_between">
-						<u-input class="flex_1" :custom-style="inputClass" v-model="form.contactName" placeholder="请输入店铺名称" placeholder-style="color:'#bbb';font-size:18px"/>
+						<u-input class="flex_1" :custom-style="inputClass" v-model="form.name" placeholder="请输入店铺名称" placeholder-style="color:'#bbb';font-size:18px"/>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="flex flex_column data-item last">
 				<view class="flex flex_column data-item last">
@@ -15,7 +15,7 @@
 					</view>
 					</view>
 					
 					
 					<view class="list-item-right flex_1 flex justify_between">
 					<view class="list-item-right flex_1 flex justify_between">
-						<u-input class="flex_1" :custom-style="inputClass" v-model="form.contactPhone" placeholder="请输入联系电话" placeholder-style="color:'#bbb';font-size:18px"/>
+						<u-input class="flex_1" :custom-style="inputClass" v-model="form.mobile" placeholder="请输入联系电话" placeholder-style="color:'#bbb';font-size:18px"/>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -23,14 +23,14 @@
 				<view class="flex flex_column data-item">
 				<view class="flex flex_column data-item">
 					<text>地址</text>
 					<text>地址</text>
 					<view class="list-item-right flex_1 flex justify_between">
 					<view class="list-item-right flex_1 flex justify_between">
-						<u-input class="flex_1" :custom-style="inputClass" v-model="form.contactAddress" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
+						<u-input class="flex_1" :custom-style="inputClass" v-model="form.receiveAddress.receiveAreasName" @click="selectAddress" :disabled="true" placeholder="请选择通信地址" placeholder-style="color:'#bbb';font-size:18px"/>
 						<u-icon class="back-img" name="arrow-right" color="#9DA8B5"  @click="selectAddress"></u-icon>
 						<u-icon class="back-img" name="arrow-right" color="#9DA8B5"  @click="selectAddress"></u-icon>
 					</view>
 					</view>
 				</view>
 				</view>
 				<view class="flex flex_column data-item last">
 				<view class="flex flex_column data-item last">
 					<text>详细地址</text>
 					<text>详细地址</text>
 					<view class="list-item-right flex_1 flex justify_between">
 					<view class="list-item-right flex_1 flex justify_between">
-						<u-input class="flex_1" :custom-style="inputClass" v-model="form.detailAddress" placeholder="请输入详细地址" placeholder-style="color:'#bbb';font-size:18px"/>
+						<u-input class="flex_1" :custom-style="inputClass" v-model="form.receiveAddress.receiveAddress" placeholder="请输入详细地址" placeholder-style="color:'#bbb';font-size:18px"/>
 					</view>
 					</view>
 				</view>
 				</view>
 			</view>
 			</view>
@@ -57,16 +57,21 @@
 
 
 <script>
 <script>
 	import {saveImgToAliOss} from '@/libs/tools.js'
 	import {saveImgToAliOss} from '@/libs/tools.js'
+	import { shopDetails,savShop } from '@/api/shop.js'
 	export default{
 	export default{
 		data(){
 		data(){
 			return{
 			return{
 				photograph: [],
 				photograph: [],
-				imageHeader:'', //  图片路径
 				form:{
 				form:{
-					contactName:'', // 名称
-					contactPhone:'', // 手机号码
-					contactAddress:"", // 通信地址
-					detailAddress:'' // 详细地址
+					name:'', // 名称
+					mobile:'', // 手机号码
+					receiveAddress: {
+					  provinceName: '',//  省
+					  cityName: '',// 市
+					  districtName: '', // 区
+					  receiveAddress: '',// 详细地址
+					  receiveAreasName:''
+					}
 				},
 				},
 				itemId:'',// 店铺id
 				itemId:'',// 店铺id
 				pageInfo:{}, // 页面数据
 				pageInfo:{}, // 页面数据
@@ -85,9 +90,16 @@
 		methods:{
 		methods:{
 			// 获取详情信息
 			// 获取详情信息
 			getDetailInfo(){
 			getDetailInfo(){
-				getDetailInfo({id:this.itemId}).then(res=>{
+				shopDetails({id:this.itemId}).then(res=>{
 					if(res.status==200){
 					if(res.status==200){
-						this.pageInfo=res.data
+						this.form.name=res.data.name? res.data.name:''
+						this.form.mobile=res.data.mobile
+						this.form.receiveAddress.provinceName=res.data.receiveAddressVO?res.data.receiveAddressVO.provinceName:''
+						this.form.receiveAddress.cityName=res.data.receiveAddressVO?res.data.receiveAddressVO.cityName:''
+						this.form.receiveAddress.districtName=res.data.receiveAddressVO?res.data.receiveAddressVO.districtName:''
+						this.form.receiveAddress.receiveAddress=res.data.receiveAddressVO?res.data.receiveAddressVO.receiveAddress:''
+						this.form.receiveAddress.receiveAreasName=res.data.receiveAddressVO?res.data.receiveAddressVO.receiveAreasName:''
+						this.photograph=res.data.receiveAddressVO?res.data.receiveAddressVO.headerImageList:[]
 					}else{
 					}else{
 						uni.showToast({
 						uni.showToast({
 							title: res.message,
 							title: res.message,
@@ -102,10 +114,10 @@
 					success:(res)=>{
 					success:(res)=>{
 						if(res){
 						if(res){
 							this.getArea(res.address)
 							this.getArea(res.address)
-							console.log(res,'------------------地址信息',this.getArea(res.address))
-							this.form.contactAddress=res.address
-							this.form.lat=res.latitude
-							this.form.lng=res.longitude
+							// this.form.contactAddress=res.address
+							// this.form.lat=res.latitude
+							// this.form.lng=res.longitude
+							this.form.receiveAddress.receiveAreasName= res.address
 							
 							
 						}
 						}
 					}
 					}
@@ -149,16 +161,73 @@
 					this.photograph.splice(index)
 					this.photograph.splice(index)
 				}, 500);
 				}, 500);
 			},
 			},
+			//截取省市区
+			getArea(str) {
+			    // let area = {}
+			    let index11 = 0
+			    let index1 = str.indexOf("省")
+			    if (index1 == -1) {
+			      index11 = str.indexOf("自治区")
+			      if (index11 != -1) {
+			        this.form.receiveAddress.provinceName = str.substring(0, index11 + 3)
+			      } else {
+			        this.form.receiveAddress.provinceName= str.substring(0, 0)
+			      }
+			    } else {
+			      this.form.receiveAddress.provinceName = str.substring(0, index1 + 1)
+			    }
+			 
+			    let index2 = str.indexOf("市")
+			    if (index11 == -1) {
+			      this.form.receiveAddress.cityName = str.substring(index11 + 1, index2 + 1)
+			    } else {
+			      if (index11 == 0) {
+			       this.form.receiveAddress.cityName = str.substring(index1 + 1, index2 + 1)
+			      } else {
+			        this.form.receiveAddress.cityName = str.substring(index11 + 3, index2 + 1)
+			      }
+			    }
+			 
+			    let index3 = str.lastIndexOf("区")
+			    if (index3 == -1) {
+			      index3 = str.indexOf("县")
+			      this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
+			    } else {
+			      this.form.receiveAddress.districtName = str.substring(index2 + 1, index3 + 1)
+			    }
+			    // return this.area;
+				if(this.form.receiveAddress==''){
+					this.form.receiveAddress.provinceName=this.form.receiveAddress.cityName
+				}
+			  },
 			// 保存
 			// 保存
 			submit(){
 			submit(){
 				const testVal=/^1[34578]\d{9}$/
 				const testVal=/^1[34578]\d{9}$/
-				if (!testVal.test(this.form.contactPhone)) {
+				if (!testVal.test(this.form.mobile)) {
 					uni.showToast({
 					uni.showToast({
 						title: '请输入正确的联系电话',
 						title: '请输入正确的联系电话',
 						icon: 'none'
 						icon: 'none'
 					})
 					})
 					return false
 					return false
 				}
 				}
+				const params=Object.assign(this.form,{sourceTypeReserve:'rider'}) 
+				if(this.photograph.length>0){
+					params.receiveAddress.headerImageList=this.photograph
+				}
+				if(this.itemId){
+					params.id=this.itemId
+				}
+				console.log(params,'-----------提交参数')
+				savShop(params).then(res=>{
+					console.log(res)
+					if(res.status==200){
+						uni.navigateBack({})
+					}
+					uni.showToast({
+						title:res.message,
+						icon:'none'
+					})
+				})
 			}
 			}
 		}
 		}
 	}
 	}

+ 36 - 11
pages/store/storeList.vue

@@ -1,21 +1,21 @@
 <template>
 <template>
 	<view class="content-store">
 	<view class="content-store">
 		<view class="input-search">
 		<view class="input-search">
-			<u-search placeholder="请输入店铺名称/电话号码" class="search" :show-action="false" input-align="center" v-model="searchVal" @input="getRow()"></u-search>
+			<u-search placeholder="请输入店铺名称/电话号码" class="search" :show-action="false" input-align="center" v-model="queryWord" @input="getRow(1)"></u-search>
 		</view>
 		</view>
 		<scroll-view scroll-y class="list" @scrolltolower="onreachBottom">
 		<scroll-view scroll-y class="list" @scrolltolower="onreachBottom">
 			<view class="list-item flex align_center" v-for="item in list" :key="item.id" @click="addStore(item.id)">
 			<view class="list-item flex align_center" v-for="item in list" :key="item.id" @click="addStore(item.id)">
 				<u-image src="/static/home_shop.png" width="160" height="160"></u-image>
 				<u-image src="/static/home_shop.png" width="160" height="160"></u-image>
 				<view class="item-right flex_1 flex justify_between align_center"> 
 				<view class="item-right flex_1 flex justify_between align_center"> 
-					<view class="right-item">
-						<view sty>百果园</view>
-						<view>18292887584</view>
-						<view>西安市未央区华帝金座</view>
+					<view class="right-item flex flex_column">
+						<view >{{item.name}}</view>
+						<view>{{item.mobile}}</view>
+						<view>{{item.address}}</view>
 					</view>
 					</view>
 					<u-icon name="arrow-right" color="#9DA8B5" font-size="30"></u-icon>
 					<u-icon name="arrow-right" color="#9DA8B5" font-size="30"></u-icon>
 				</view>
 				</view>
 			</view>
 			</view>
-			<view class="nodata" v-if="list.length==0 && status!='loading'">
+			<view class="nodata flex justify_center align_center" v-if="list.length==0 && status!='loading'">
 				<u-empty src="/static/def_result.png" :text="noDataText" icon-size="260" ></u-empty>
 				<u-empty src="/static/def_result.png" :text="noDataText" icon-size="260" ></u-empty>
 			</view>
 			</view>
 			<view v-if="index==current" style="padding: 20upx;">
 			<view v-if="index==current" style="padding: 20upx;">
@@ -29,7 +29,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-	import { historyOrderQuery } from '@/api/order.js'
+	import { shopList } from '@/api/shop.js'
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
@@ -39,6 +39,7 @@
 				total: 0,  //  数据总条数
 				total: 0,  //  数据总条数
 				noDataText: '暂无数据',  //  列表请求状态提示语
 				noDataText: '暂无数据',  //  列表请求状态提示语
 				status: 'loadmore',  //  加载中状态
 				status: 'loadmore',  //  加载中状态
+				queryWord:''
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
@@ -49,6 +50,9 @@
 				menus: ['shareAppMessage', 'shareTimeline']
 				menus: ['shareAppMessage', 'shareTimeline']
 			})
 			})
 		},
 		},
+		onShow() {
+			this.getRow(1)
+		},
 		methods: {
 		methods: {
 			pageInit() {
 			pageInit() {
 				this.pageNo = 1
 				this.pageNo = 1
@@ -85,6 +89,15 @@
 					this.status = "nomore"
 					this.status = "nomore"
 				}
 				}
 			},
 			},
+			getArea(obj,state) {
+			var index=obj.lastIndexOf("\市");
+			if(state==0){
+			obj=obj.substring(0,index);
+			}else {
+			obj=obj.substring(index+1,obj.length);
+			}
+			return obj;
+			},
 			// 查询列表
 			// 查询列表
 			getRow(pageNo) {
 			getRow(pageNo) {
 				this.status = "loadmore"
 				this.status = "loadmore"
@@ -94,11 +107,19 @@
 				let params = {
 				let params = {
 					pageNo: this.pageNo,
 					pageNo: this.pageNo,
 					pageSize: this.pageSize,
 					pageSize: this.pageSize,
+					queryWord:this.queryWord
 				}
 				}
 				this.noDataText = '暂无数据'
 				this.noDataText = '暂无数据'
 				this.status = "loading"
 				this.status = "loading"
-				historyOrderQuery(params).then(res => {
+				shopList(params).then(res => {
 					if (res.status == 200) {
 					if (res.status == 200) {
+						res.data.list.map(item=>{
+							if(item.receiveAddressVO.receiveAreasName){
+								item.cityAddress=this.getArea(item.receiveAddressVO.receiveAreasName,1)
+							}
+							console.log(item.cityAddress,'-----------item.cityAddress=============')
+							item.address=item.receiveAddressVO ? ((item.receiveAddressVO.receiveAddress? item.receiveAddressVO.receiveAddress:'')+(item.cityAddress? '('+item.cityAddress+')':'')) : ''
+						})
 						if (this.pageNo > 1) {
 						if (this.pageNo > 1) {
 							this.list = this.list.concat(res.data.list || [])
 							this.list = this.list.concat(res.data.list || [])
 						} else {
 						} else {
@@ -117,7 +138,7 @@
 			addStore(id){
 			addStore(id){
 				const storeId=id ? id : ''
 				const storeId=id ? id : ''
 				uni.navigateTo({
 				uni.navigateTo({
-					url:`/pages/store/addStore?id={storeId}`
+					url:`/pages/store/addStore?id=${storeId}`
 				})
 				})
 			}
 			}
 		}
 		}
@@ -148,6 +169,7 @@
 		}
 		}
 		.list{
 		.list{
 			flex: 1;
 			flex: 1;
+			overflow-y: scroll;
 			.list-item{
 			.list-item{
 				padding: 32upx;
 				padding: 32upx;
 				background-color: #fff;
 				background-color: #fff;
@@ -155,13 +177,16 @@
 					margin-left:16upx;
 					margin-left:16upx;
 					border-bottom: 1px solid #e5e5e5;
 					border-bottom: 1px solid #e5e5e5;
 					.right-item{
 					.right-item{
-						height: 160upx;
+						min-height: 160upx;
 						view{
 						view{
-							height: 33%;
+							min-height: 53upx;
 						}
 						}
 					}
 					}
 				}
 				}
 			}
 			}
+			.nodata{
+				margin-top: 50%;
+			}
 		}
 		}
 		.footer{
 		.footer{
 			width: 100%;
 			width: 100%;