lalala 6 лет назад
Родитель
Сommit
1b33e5fc12

+ 3 - 0
mobile-code/src/api/common/index.js

@@ -5,6 +5,9 @@ export const getOptions = param => https.get('/apihkds/api/option/getOptions', p
 // 图片上传
 export const uploadPic = data => https.post('/upload/save-img', data)
 
+// M 端商家信息
+export const getMerchantInfo = param => https.get('/merchant/get-info', param)
+
 // M 端用户信息
 export const getShopUserApi = param => https.get('/user/my-profile', param)
 

+ 165 - 139
mobile-code/src/pages/callback/index.vue

@@ -42,7 +42,7 @@
 				<block v-else-if="pagestatus == 6">
 					<div class="call-back-wrap">
 						<div class="qr-code-img">
-							<img :src="shopUser.smallWxQrCodeUrl" alt="二维码" mode="widthFix" />
+							<img :src="merchantInfo.smallWxQrCodeUrl" alt="二维码" mode="widthFix" />
 						</div>
 						<div class="app-color-2">最后一步</div>
 						<div class="app-color-2">识别二维码并关注公众号</div>
@@ -97,11 +97,17 @@
 				</div>
 			</template>
 		</modal-module>
+		<!-- 未设置支付密码弹窗 -->
+		<alert-module :show="setPassModal" btnText="去设置" btnColor="#FF2842" padding="66rpx 24rpx 66rpx 24rpx" @click="hideAlert">
+			<div class="go-login-module">
+				<div>暂未设置密码,去设置密码!</div>
+			</div>
+		</alert-module>
 	</div>
 </template>
 
 <script>
-/** *
+	/** *
 	 * 页面状态
 	 * @parmas pagestatus 进入页面的状态
 	 * @parmas 1 待支付 - 余额支付 或者 微信支付 -- awaitPayYe
@@ -111,154 +117,174 @@
 	 * @parmas 5 支付成功 - 扫码支付 -- successPayCode
 	 * @parmas 6 申请成功 - 申请会员 -- registerMember
 	 */
-import { mapGetters } from 'vuex'
-import ModalModule from '@/components/plugin/modal'
-//  api
-import wexinPay from '@/utils/pay/wxPay'
-import { getShopUser } from '@/utils/auth'
-import { balancePay, wxPay } from '@/api/order'
-export default {
-	name: 'callback',
-	components: {
-		ModalModule
-	},
-	data() {
-		return {
-			constant: this.$constant,
-			pageTit: '',
-			pagestatus: 1,
-			contentClass: '',
-			payDiscountPrice: null,
-			// 支付相关 ============
-			passwordModal: false,
-			form: {
-				payPassword: ''
-			},
+	import { mapGetters } from 'vuex'
+	import ModalModule from '@/components/plugin/modal'
+	import AlertModule from '@/components/plugin/alert'
+	//  api
+	import wexinPay from '@/utils/pay/wxPay'
+	import { getMerchantInfo } from '@/api/common'
+	import { getShopUser } from '@/utils/auth'
+	import { balancePay, wxPay } from '@/api/order'
+	export default {
+		name: 'callback',
+		components: {
+			ModalModule,
+			AlertModule
+		},
+		data() {
+			return {
+				constant: this.$constant,
+				pageTit: '',
+				pagestatus: 1,
+				contentClass: '',
+				payDiscountPrice: null,
+				// 支付相关 ============
+				passwordModal: false,
+				form: {
+					payPassword: ''
+				},
 
-			payCallData: {}
-		}
-	},
-	computed: {
-		...mapGetters({ shopUser: 'getShopUser' }),
-		isYeBtnShow() {
-			if (this.$util.isEmpty(this.shopUser)) return false
-			return this.shopUser.userAsset.balance > this.option.totalPrice
-		}
-	},
-	onLoad() {
-		// if (this.pagestatus) {
-		// 	this.init()
-		// }
-	},
-	methods: {
-		init() {
-			this.pagestatus = this.option.pagestatus
-			this.payDiscountPrice = this.option.payDiscountPrice
-			this.initClass(this.pagestatus)
-			getShopUser()
+				payCallData: {},
+				merchantInfo: {},
+				// 未设置密码
+				setPassModal: false
+			}
 		},
-		// 支付相关块 =======================================================
-		// 余额支付
-		_balancePay() {
-			if (!this.form.payPassword) {
-				this.$msg('请先输入支付密码!')
-				return false
+		computed: {
+			...mapGetters({ shopUser: 'getShopUser' }),
+			isYeBtnShow() {
+				if (this.$util.isEmpty(this.shopUser)) return false
+				return this.shopUser.userAsset.balance > this.option.totalPrice
 			}
-			balancePay({
-				payPassword: this.form.payPassword,
-				orderSn: this.option.orderSn,
-				couponId: this.option.couponId
-			})
-				.then(res => {
-					this.modalCancel()
-					this.$msg('支付成功!')
+		},
+		onLoad() {
+			// if (this.pagestatus) {
+			// 	this.init()
+			// }
+		},
+		methods: {
+			init() {
+				this.pagestatus = this.option.pagestatus
+				this.payDiscountPrice = this.option.payDiscountPrice
+				this.initClass(this.pagestatus)
+				getShopUser()
+				// 商户信息
+				// if (this.pagestatus == 6) {
+				getMerchantInfo().then(res => {
+					this.merchantInfo = res.data
+				})
+				// }
+			},
+			// 支付相关块 =======================================================
+			// 余额支付
+			_balancePay() {
+				if (!this.form.payPassword) {
+					this.$msg('请先输入支付密码!')
+					return false
+				}
+				balancePay({
+					payPassword: this.form.payPassword,
+					orderSn: this.option.orderSn,
+					couponId: this.option.couponId
+				})
+					.then(res => {
+						this.modalCancel()
+						this.$msg('支付成功!')
 
+						this.payCallData = res.data
+						this.paySuccess()
+					})
+					.catch(e => {
+						this.$msg(e.msg)
+						this.payFail(e)
+					})
+			},
+			// 微信支付
+			_wxPay() {
+				wxPay({
+					orderSn: this.option.orderSn,
+					couponId: this.option.couponId
+				}).then(res => {
 					this.payCallData = res.data
-					this.paySuccess()
+					wexinPay(res.data, this.paySuccess, this.payFail)
 				})
-				.catch(e => {
-					this.$msg(e.msg)
-					this.payFail(e)
+			},
+			paySuccess() {
+				this.$util.pageTo({
+					url: '/pages/callback/index',
+					type: 2,
+					query: {
+						...this.option,
+						pagestatus: 3,
+						// orderSn: this.option.orderSn,
+						payDiscountPrice: this.payCallData.discountAmount
+					}
 				})
-		},
-		// 微信支付
-		_wxPay() {
-			wxPay({
-				orderSn: this.option.orderSn,
-				couponId: this.option.couponId
-			}).then(res => {
-				this.payCallData = res.data
-				wexinPay(res.data, this.paySuccess, this.payFail)
-			})
-		},
-		paySuccess() {
-			this.$util.pageTo({
-				url: '/pages/callback/index',
-				type: 2,
-				query: {
-					...this.option,
-					pagestatus: 3,
-					// orderSn: this.option.orderSn,
-					payDiscountPrice: this.payCallData.discountAmount
+			},
+			payFail() {
+				alert('支付失败!')
+			},
+			balancePayFn() {
+				if (this.merchantInfo.hasPayPwd == 0) {
+					this.setPassModal = true
+				} else {
+					this.passwordModal = true
+				}
+			},
+			passwordModalClick(e) {
+				if (e.index === 0) {
+					this.modalCancel()
+				} else {
+					this._balancePay()
+				}
+			},
+			modalCancel() {
+				this.passwordModal = false
+				this.form.payPassword = ''
+			},
+			// 暂未设置密码
+			hideAlert() {
+				this.$util.pageTo('/pages/user/password')
+			},
+			// 初始样式
+			initClass(val) {
+				switch (val) {
+					case '1':
+						this.pageTit = '待支付'
+						this.contentClass = 'awaitPayYe'
+						break
+					case '2':
+						this.pageTit = '待支付'
+						this.contentClass = 'awaitPayWx'
+						break
+					case '3':
+						this.pageTit = '支付成功'
+						this.contentClass = 'successPay'
+						break
+					case '4':
+						this.pageTit = '评价成功'
+						this.contentClass = 'successEval'
+						break
+					case '5':
+						this.pageTit = '支付成功'
+						this.contentClass = 'successPayCode'
+						break
+					case '6':
+						this.pageTit = '提交成功'
+						this.contentClass = 'registerMember'
+						break
+					default:
+						this.pageTit = '支付成功'
+						this.contentClass = 'awaitPayYe'
+						break
 				}
-			})
-		},
-		payFail() {
-			alert('支付失败!')
-		},
-		balancePayFn() {
-			this.passwordModal = true
-		},
-		passwordModalClick(e) {
-			if (e.index === 0) {
-				this.modalCancel()
-			} else {
-				this._balancePay()
-			}
-		},
-		modalCancel() {
-			this.passwordModal = false
-			this.form.payPassword = ''
-		},
-		// 初始样式
-		initClass(val) {
-			switch (val) {
-				case '1':
-					this.pageTit = '待支付'
-					this.contentClass = 'awaitPayYe'
-					break
-				case '2':
-					this.pageTit = '待支付'
-					this.contentClass = 'awaitPayWx'
-					break
-				case '3':
-					this.pageTit = '支付成功'
-					this.contentClass = 'successPay'
-					break
-				case '4':
-					this.pageTit = '评价成功'
-					this.contentClass = 'successEval'
-					break
-				case '5':
-					this.pageTit = '支付成功'
-					this.contentClass = 'successPayCode'
-					break
-				case '6':
-					this.pageTit = '提交成功'
-					this.contentClass = 'registerMember'
-					break
-				default:
-					this.pageTit = '支付成功'
-					this.contentClass = 'awaitPayYe'
-					break
-			}
 
-			uni.setNavigationBarTitle({
-				title: this.pageTit
-			})
+				uni.setNavigationBarTitle({
+					title: this.pageTit
+				})
+			}
 		}
 	}
-}
 </script>
 
 <style lang="scss" scoped>

+ 9 - 5
mobile-code/src/pages/home/components/login-popup.vue

@@ -52,7 +52,7 @@
 						<div class="wx-public-content">
 							<div class="wx-text-wrap">
 								<div class="app-color-2">请搜索公众号</div>
-								<div class="app-color-1">am</div>
+								<div class="app-color-1">{{ merchantInfo.wxAliasName }}</div>
 								<div class="app-color-2">关注即升级为会员</div>
 							</div>
 							<button class="button-com red big" @click="copyFn">复制</button>
@@ -108,12 +108,16 @@
 			isPublic: {
 				type: Boolean,
 				default: false
+			},
+			merchantInfo: {
+				type: Object,
+				default: () => {}
 			}
 		},
 		data() {
 			return {
 				constant: this.$constant,
-				stepIndex: 2,
+				stepIndex: 0,
 				wxPhoneInfo: '',
 				wxInfo: {}
 			}
@@ -181,10 +185,10 @@
 			// 复制
 			copyFn() {
 				uni.setClipboardData({
-					data: 'am',
+					data: this.merchantInfo.wxAliasName,
 					success: () => {
 						this.$msg('复制成功,请前往关注公众号!')
-						this.hidePopup()
+						// this.hidePopup()
 					},
 					fail: () => {
 						this.$msg('复制失败,请重试!')
@@ -257,7 +261,7 @@
 				// box-shadow: 2px 2px 10px #eee;
 				// margin: 130px auto 194px;
 				margin: 0 auto;
-				height: 480px;
+				height: 440px;
 				border-radius: 10px;
 				display: flex;
 				align-items: center;

+ 8 - 3
mobile-code/src/pages/home/user.vue

@@ -108,7 +108,7 @@
 			</tui-list-view>
 		</div>
 		<!-- 登录弹窗 -->
-		<login-popup :show="popupShow" :info="wxInfo" :isPublic="isPublic" @hide="hidePopup" />
+		<login-popup :show="popupShow" :info="wxInfo" :merchantInfo="merchantInfo" :isPublic="isPublic" @hide="hidePopup" />
 		<!-- 登录弹窗 -->
 		<app-trademark />
 		<!-- <app-footer :activeIndex="3" /> -->
@@ -127,6 +127,7 @@ import AppTrademark from '@/components/module/app-trademark'
 import GoLogin from '@/pages/home/components/go-login.vue'
 import { getMiniAppUrl, isWxBrowser } from '@/utils/common'
 // api
+import { getMerchantInfo } from '@/api/common'
 import { getShopUser } from '@/utils/auth'
 // import { getWxInfo, getWxPhone } from '@/api/mini'
 export default {
@@ -142,11 +143,12 @@ export default {
 	data() {
 		return {
 			constant: this.$constant,
-			popupShow: true,
+			popupShow: false,
 			isPublic: false,
 			stepIndex: 0,
 			wxInfo: {},
-			loginShow: false
+			loginShow: false,
+			merchantInfo: {}
 		}
 	},
 	computed: {
@@ -173,6 +175,9 @@ export default {
 					this.popupShow = true
 				}
 			})
+			getMerchantInfo().then(res => {
+				this.merchantInfo = res.data
+			})
 		},
 		// pageTo
 		pageToFn(item) {

+ 2 - 2
mobile-code/src/pages/order/list.vue

@@ -32,14 +32,14 @@
 						}
 					})">立即付款</button>
 					</block>
-					<block v-if="item.status == 1">
+					<!-- <block v-if="item.status == 1">
 						<button class="button-com red defalut" @click.stop="pageTo({
 						url: '/pages/order/buy',
 						query: {
 							id: item.id
 						}
 					})">填写收花地址</button>
-					</block>
+					</block> -->
 					<block v-if="item.status == 5">
 						<button class="button-com red defalut" @click.stop="pageTo({
 						url: '/pages/order/comment',

+ 83 - 57
mobile-code/src/pages/user/password.vue

@@ -2,7 +2,7 @@
 	<div class="app-content">
 		<form @submit="formSubmit">
 			<div class="module-com">
-				<tui-list-cell class="line-cell" :hover="false">
+				<tui-list-cell class="line-cell" :hover="false" v-if="shopUser.hasPayPwd == 1">
 					<div class="tui-title">旧密码</div>
 					<input v-model="form.old" placeholder-class="phcolor" class="tui-input" name="old" placeholder="请输入旧密码" maxlength="50" type="password" />
 				</tui-list-cell>
@@ -24,68 +24,94 @@
 </template>
 
 <script>
-import TuiListCell from '@/components/plugin/list-cell'
-const form = require('@/utils/formValidation.js')
-// api
-import { modifyPassword } from '@/api/member'
-export default {
-	name: 'password',
-	components: {
-		TuiListCell
-	},
-	data() {
-		return {
-			form: {
-				old: '',
-				new: '',
-				confirm: ''
-			}
-		}
-	},
-	methods: {
-		// 确认
-		confirmFn() {
-			modifyPassword(this.form).then(res => {
-				this.$msg('修改成功!')
-				setTimeout(() => {
-					uni.switchTab({
-						url: '/pages/home/user'
-					})
-				}, 1000)
-			})
+	import { mapGetters } from 'vuex'
+	import TuiListCell from '@/components/plugin/list-cell'
+	const form = require('@/utils/formValidation.js')
+	// api
+	import { getShopUser } from '@/utils/auth'
+	import { modifyPassword } from '@/api/member'
+	export default {
+		name: 'password',
+		components: {
+			TuiListCell
 		},
-		// 表单验证
-		formSubmit(e) {
-			// 表单规则
-			let rules = [
-				{
-					name: 'old',
-					rule: ['required'],
-					msg: ['请输入旧密码']
-				},
-				{
-					name: 'new',
-					rule: ['required'],
-					msg: ['请输入新密码']
+		data() {
+			return {
+				form: {
+					old: '',
+					new: '',
+					confirm: ''
 				},
-				{
-					name: 'confirm',
-					rule: ['required'],
-					msg: ['请输入确认密码']
+				rules: []
+			}
+		},
+		computed: {
+			...mapGetters({ shopUser: 'getShopUser' })
+		},
+		methods: {
+			init() {
+				getShopUser().then(res => {
+					if (res.hasPayPwd == 1) {
+						this.rules = [
+							{
+								name: 'old',
+								rule: ['required'],
+								msg: ['请输入旧密码']
+							},
+							{
+								name: 'new',
+								rule: ['required'],
+								msg: ['请输入新密码']
+							},
+							{
+								name: 'confirm',
+								rule: ['required'],
+								msg: ['请输入确认密码']
+							}
+						]
+					} else {
+						this.rules = [
+							{
+								name: 'new',
+								rule: ['required'],
+								msg: ['请输入新密码']
+							},
+							{
+								name: 'confirm',
+								rule: ['required'],
+								msg: ['请输入确认密码']
+							}
+						]
+					}
+				})
+			},
+			// 确认
+			confirmFn() {
+				modifyPassword(this.form).then(res => {
+					this.$msg('修改成功!')
+					setTimeout(() => {
+						uni.switchTab({
+							url: '/pages/home/user'
+						})
+					}, 1000)
+				})
+			},
+			// 表单验证
+			formSubmit(e) {
+				// 表单规则
+				let rules = this.rules
+				// 进行表单检查
+				let formData = e.detail.value
+				let checkRes = form.validation(formData, rules)
+				// 验证通过!
+				if (!checkRes) {
+					this.confirmFn()
+				} else {
+					this.$msg(checkRes)
 				}
-			]
-			// 进行表单检查
-			let formData = e.detail.value
-			let checkRes = form.validation(formData, rules)
-			// 验证通过!
-			if (!checkRes) {
-				this.confirmFn()
-			} else {
-				this.$msg(checkRes)
 			}
 		}
 	}
-}
 </script>
 
 <style lang="scss" scoped>