Просмотр исходного кода

供货商的客户手动添加

jf 5 лет назад
Родитель
Сommit
e8a7926e3b

+ 10 - 5
ghsApp/src/admin/billing/affirm.vue

@@ -123,10 +123,7 @@
       </button>
     </view>
     <!-- 选择客户 -->
-    <AppCustomerSel
-      :show.sync="showCustomer"
-      @change="changeCustomerFn"
-    />
+    <AppCustomerSel :isNewClient.sync="isNewClient" :show.sync="showCustomer" @change="changeCustomerFn"/>
   </view>
 </template>
 
@@ -181,7 +178,7 @@ export default {
       },
       money: "",
 						realMoney: 0,
-      showCustomer: false,
+      showCustomer: false
     };
   },
   onLoad () {
@@ -198,6 +195,14 @@ export default {
     }
     this.realMoney = this.allPrice.toFixed(2);
   },
+	onShow(){
+		if(!this.$util.isEmpty(uni.getStorageSync("newClient"))){
+			this.showCustomer = true;
+		}
+	},
+	onUnload(){
+			uni.removeStorageSync('newClient');
+	},
   computed: {
     ...mapGetters(["getMerchantInfo", "getLoginInfo"]),
   },

+ 3 - 0
ghsApp/src/admin/home/member.vue

@@ -119,6 +119,9 @@ export default {
     }
   },
   onLoad(option) {},
+	onShow(){
+		uni.removeStorageSync('newClient');
+	},
   methods: {
     init() {
       if(!this.AUTHORITY_SHOW) {

+ 15 - 19
ghsApp/src/components/app-customer-sel.vue

@@ -28,23 +28,18 @@
 				</div>-->
 				<!-- 列表 -->
 				<scroll-view class="customer-list" scroll-y>
-					<view
-						v-for="(item, index) in customerListData"
-						:key="index"
-						@click="switchCustomer(item, index)"
-						class="customer-item"
-					>
+					<view v-for="(item, index) in customerListData" :key="index" @click="switchCustomer(item, index)" class="customer-item">
 						<view class="item-avatar">
 							<image :src="item.smallAvatar" alt="商品图" />
 						</view>
-						<view class="item-name"> {{ item.name || "" }}</view>
+						<view class="item-name"> {{ item.name || "" }} <text v-if="newClientId==item.id">新客户</text></view>
 						<view class="item-level">{{ getCustomerLevelName(item) }}</view>
 						<!-- <view class="item-tag">NEW</view> -->
 					</view>
 				</scroll-view>
-<!--				<view class="add-customer-bar" @click="gotoAddCustomer">-->
-<!--					没有找到客户?新增-->
-<!--				</view>-->
+				<view class="add-customer-bar" @click="gotoAddCustomer">
+					没有找到客户?新增
+				</view>
 			</div>
 		</bottom-popup>
 	</div>
@@ -74,6 +69,7 @@ export default {
 		return {
 			showPopup: false,
 			name: "",
+			newClientId: "",
 			customerListData: []
 		};
 	},
@@ -81,14 +77,9 @@ export default {
 		this.showPopup = this.show;
 	},
 	computed: {},
-	// onLoad(val) {
-
-	// },
-
 	watch: {
 		show(val) {
 			this.showPopup = val;
-
 			// #ifdef H5
 			this.$nextTick(function() {
 				setTimeout(() => {
@@ -106,9 +97,8 @@ export default {
 		initList() {
 			return getList({ type: "1", name: this.name })
 				.then(res => {
-					const {
-						data: { list }
-					} = res;
+					const {data: { list }} = res;
+					this.newClientId = uni.getStorageSync("newClient")?uni.getStorageSync("newClient").id:'';
 					this.customerListData = list;
 				})
 				.catch(err => {});
@@ -217,7 +207,13 @@ export default {
 			.item-name {
 				flex-shrink: 0;
 				margin: 0 20upx;
-				width: 200upx;
+				/*width: 200upx;*/
+				text{
+					padding: 0 10rpx;
+					margin-left: 20rpx;
+					color: #3385ff;
+					border: 1px solid #3385ff;
+				}
 			}
 			.item-level {
 				margin: 0 20upx;

+ 2 - 1
ghsApp/src/components/plugin/tabs.vue

@@ -246,7 +246,8 @@ export default {
 		},
 		// 新增
 		add() {
-			this.$emit("add");
+			uni.navigateTo({url:'/pagesClient/member/add'})
+			// this.$emit("add");
 		}
 	}
 };

+ 56 - 42
ghsApp/src/pagesClient/member/add.vue

@@ -6,44 +6,47 @@
 					<div class="tui-title required">花店名称</div>
 					<input v-model="form.name" placeholder-class="phcolor" class="tui-input" name="name" placeholder="请输入" maxlength="50" type="text" />
 				</tui-list-cell>
+				<!--<tui-list-cell class="line-cell" :hover="false">-->
+					<!--<div class="tui-title required">店长姓名</div>-->
+					<!--<input v-model="form.adminName" placeholder-class="phcolor" class="tui-input" name="adminName" placeholder="请输入" maxlength="50" type="text" />-->
+				<!--</tui-list-cell>-->
 				<tui-list-cell class="line-cell" :hover="false">
-					<div class="tui-title required">店长姓名</div>
-					<input v-model="form.adminName" placeholder-class="phcolor" class="tui-input" name="adminName" placeholder="请输入" maxlength="50" type="text" />
-				</tui-list-cell>
-				<tui-list-cell class="line-cell" :hover="false">
-					<div class="tui-title required">店长手机号</div>
+					<div class="tui-title required">手机号</div>
 					<input v-model="form.mobile" placeholder-class="phcolor" class="tui-input" name="mobile" placeholder="请输入" maxlength="50" type="number" />
 				</tui-list-cell>
 				<tui-list-cell class="line-cell" :hover="false">
 					<div class="tui-title required">确认手机号</div>
 					<input v-model="form.confirmMobile" placeholder-class="phcolor" class="tui-input" name="confirmMobile" placeholder="请输入" maxlength="50" type="number" />
 				</tui-list-cell>
-				<view class="line-hint_bx">
-					以下选填
-				</view>
-				<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">
-					<div class="tui-title">所在城市</div>
-					<div class="tui-input" v-if="form.province">{{ form.province + '-' + form.city }}</div>
-					<div class="tui-placeholder" v-else>请选择</div>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">地址</div>
+					<input v-model="form.address" placeholder-class="phcolor" class="tui-input" name="confirmMobile" placeholder="请输入" maxlength="50" type="text" />
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<div class="tui-title">允许欠款</div>
+					<switch :checked="form.debt" @change="form.debt = !form.debt" color="#3385FF"/>
 				</tui-list-cell>
-				 <tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selRegionFn">
-					<div class="tui-title">详细地址</div>
-					<div class="tui-input" v-if="form.address">{{ form.address }}</div>
-					<div class="tui-placeholder" v-else>请填写详细地址</div>
-					</tui-list-cell>
-					<tui-list-cell class="line-cell" :hover="false">
-						<div class="tui-title">门牌号</div>
-						<input
-							v-model="form.floor"
-							placeholder-class="phcolor"
-							placeholder-style="color:#CCCCCC"
-							class="tui-input"
-							placeholder="楼号门牌号(选填)"
-						/>
-					</tui-list-cell>
+				<!--<view class="line-hint_bx">-->
+					<!--以下选填-->
+				<!--</view>-->
+				<!--<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">-->
+					<!--<div class="tui-title">所在城市</div>-->
+					<!--<div class="tui-input" v-if="form.province">{{ form.province + '-' + form.city }}</div>-->
+					<!--<div class="tui-placeholder" v-else>请选择</div>-->
+				<!--</tui-list-cell>-->
+				 <!--<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="selRegionFn">-->
+					<!--<div class="tui-title">详细地址</div>-->
+					<!--<div class="tui-input" v-if="form.address">{{ form.address }}</div>-->
+					<!--<div class="tui-placeholder" v-else>请填写详细地址</div>-->
+					<!--</tui-list-cell>-->
+					<!--<tui-list-cell class="line-cell" :hover="false">-->
+						<!--<div class="tui-title">门牌号</div>-->
+						<!--<input v-model="form.floor" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" placeholder="楼号门牌号(选填)"/>-->
+					<!--</tui-list-cell>-->
 					<div class="btn-wrap">
-					<button class="admin-button-com blue big" formType="submit">确认</button>
-				</div>		
+					<!--<button class="admin-button-com blue big" formType="submit">确认</button>-->
+					<button class="admin-button-com blue big" @click="confirmFn" >确认</button>
+				</div>
 			</div>
 			<!-- 选择地区 -->
 			<app-area-sel :show.sync="showRegion" @change="changeAreaFn" :city="form.city" />
@@ -92,7 +95,8 @@ export default {
 				name: '',
 				adminName: '',
 				lat:'',
-				long: ''
+				long: '',
+				debt:true
 			},
 			levelSelData: {}
 		}
@@ -125,16 +129,26 @@ export default {
 			this.$refs.simpleAddress.open();
 		},
 		confirmFn() {
+			let pattern = /^1\d{10}$/;  //验证以1开头11位数
+			if(this.$util.isEmpty(this.form.name)){this.$msg('请输入花店名称');return;}
+			if(!pattern.test(this.form.mobile)){this.$msg('请输入正确的手机号');return;}
+			if(this.form.mobile!=this.form.confirmMobile){this.$msg('两次手机号不一致');return;}
 			add({
-				...this.form,
-				mobile: +this.form.mobile,
-				confirmMobile: +this.form.confirmMobile
+				name:this.form.name,
+				mobile: this.form.mobile,
+				confirmMobile: this.form.confirmMobile,
+				address:this.form.address,
+				debt:this.form.debt?1:0,
 			}).then(res => {
-				this.$msg('添加成功!')
+				this.$msg('添加成功!');
+				uni.setStorageSync('newClient', res.data)
 				setTimeout(() => {
-					uni.reLaunch({
-						url: '/admin/home/member'
-					});
+					// uni.reLaunch({
+					// 	url: '/admin/home/member'
+					// });
+						uni.navigateBack({
+							delta: 1
+						})
 				}, 1000)
 			})
 		},
@@ -151,11 +165,11 @@ export default {
 					rule: ['required'],
 					msg: ['请输入花店名称']
 				},
-				{
-					name: 'adminName',
-					rule: ['required'],
-					msg: ['请输入店长名称']
-				},
+				// {
+				// 	name: 'adminName',
+				// 	rule: ['required'],
+				// 	msg: ['请输入店长名称']
+				// },
 				{
 					name: 'mobile',
 					rule: ['required'],