|
|
@@ -0,0 +1,1397 @@
|
|
|
+<!--
|
|
|
+ 邀请开店 / 会员开通页
|
|
|
+ 用途:分享带邀请码新用户注册+支付;已开店用户仅填邀请码并本页支付
|
|
|
+-->
|
|
|
+<template>
|
|
|
+ <view class="apply-page app-content">
|
|
|
+ <form @submit="formSubmit">
|
|
|
+ <view class="apply-body">
|
|
|
+ <!-- 年度会员价横幅 -->
|
|
|
+ <view class="member-banner">
|
|
|
+ <image
|
|
|
+ v-if="memberBannerBg"
|
|
|
+ class="member-banner-bg"
|
|
|
+ :src="memberBannerBg"
|
|
|
+ mode="aspectFill"
|
|
|
+ />
|
|
|
+ <view class="member-banner-text">
|
|
|
+ <text class="member-banner-title">{{ feePreview.memberTypeName || '年度会员' }}</text>
|
|
|
+ <view class="member-banner-price-row">
|
|
|
+ <text class="member-banner-yen">¥</text>
|
|
|
+ <text class="member-banner-price">{{ priceInteger }}</text>
|
|
|
+ <text class="member-banner-unit">/年</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-if="hasShop" class="apply-section">
|
|
|
+ <view class="apply-section-title">当前门店</view>
|
|
|
+ <view class="module-com apply-card">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">门店名称</view>
|
|
|
+ <view class="tui-input">{{ shopBrief.name || '—' }}</view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">联系电话</view>
|
|
|
+ <view class="tui-input">{{ shopBrief.mobile || '—' }}</view>
|
|
|
+ </tui-list-cell>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-if="!hasShop" class="apply-section">
|
|
|
+ <view class="apply-section-title">门店信息</view>
|
|
|
+ <view class="module-com apply-card">
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">类型</view>
|
|
|
+ <view class="apply-mode-btns">
|
|
|
+ <view class="apply-mode-btn" :class="{ 'apply-mode-btn--active': isHd == 1 }" @click="isHd = 1">有开店</view>
|
|
|
+ <view class="apply-mode-btn apply-mode-btn--last" :class="{ 'apply-mode-btn--active': isHd == 0 }" @click="isHd = 0">没开店</view>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">{{ isHd == 1 ? '你的店名' : '收货姓名' }}</view>
|
|
|
+ <input v-model="form.name" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="name" placeholder="请填写名称" />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell line-cell--city" :hover="false">
|
|
|
+ <view class="tui-title">所在城市</view>
|
|
|
+ <view class="city-row-main" @click="openAddres">
|
|
|
+ <view class="tui-input" v-if="form.province">{{ form.province + '-' + form.city }}</view>
|
|
|
+ <view class="tui-placeholder" v-else>请选择城市</view>
|
|
|
+ </view>
|
|
|
+ <view class="city-locate-btn" @click.stop="locateCity">
|
|
|
+ <image class="city-locate-icon" :src="iconSrc('general-location')" mode="aspectFit"></image>
|
|
|
+ </view>
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell v-if="hasMap == 0" class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">所在地址</view>
|
|
|
+ <input v-model="form.address" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="address" @input="modifyShow" placeholder="请填写地址" />
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell v-else class="line-cell" :hover="false" :arrow="true" @click="selectRegion">
|
|
|
+ <view class="tui-title">所在地址</view>
|
|
|
+ <view v-if="form.address" class="tui-input">{{ form.address }}</view>
|
|
|
+ <view v-else class="tui-placeholder">请搜索选择地址</view>
|
|
|
+ <input v-model="form.address" name="address" hidden />
|
|
|
+ </tui-list-cell>
|
|
|
+
|
|
|
+ <tui-list-cell class="line-cell" :hover="false">
|
|
|
+ <view class="tui-title">楼号门牌</view>
|
|
|
+ <input v-model="form.floor" type="text" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="floor" placeholder="选填" @input="modifyShow" />
|
|
|
+ </tui-list-cell>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view v-if="!hasShop" class="apply-section">
|
|
|
+ <view class="apply-section-title">注册人信息</view>
|
|
|
+ <view class="module-com apply-card">
|
|
|
+ <tui-list-cell class="line-cell code-wrap name-wrap" :hover="false">
|
|
|
+ <view class="tui-title required">姓名</view>
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
+ <input
|
|
|
+ v-model="form.adminName"
|
|
|
+ type="nickname"
|
|
|
+ placeholder-class="phcolor"
|
|
|
+ placeholder-style="color:#CCCCCC"
|
|
|
+ class="tui-input"
|
|
|
+ name="adminName"
|
|
|
+ placeholder="请填写姓名"
|
|
|
+ @blur="onNameBlur"
|
|
|
+ @input="onNameInput"
|
|
|
+ />
|
|
|
+ <!-- #endif -->
|
|
|
+ <!-- #ifndef MP-WEIXIN -->
|
|
|
+ <input
|
|
|
+ v-model="form.adminName"
|
|
|
+ type="text"
|
|
|
+ placeholder-class="phcolor"
|
|
|
+ placeholder-style="color:#CCCCCC"
|
|
|
+ class="tui-input"
|
|
|
+ name="adminName"
|
|
|
+ placeholder="请填写姓名"
|
|
|
+ />
|
|
|
+ <!-- #endif -->
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell class="line-cell code-wrap mobile-wrap" :hover="false">
|
|
|
+ <view class="tui-title required">手机号</view>
|
|
|
+ <input
|
|
|
+ v-model="form.mobile"
|
|
|
+ type="number"
|
|
|
+ placeholder-class="phcolor"
|
|
|
+ @blur="checkShopFn"
|
|
|
+ placeholder-style="color:#CCCCCC"
|
|
|
+ class="tui-input tui-input--code"
|
|
|
+ :class="{ 'tui-input--filled': fillMobile == 0 }"
|
|
|
+ name="mobile"
|
|
|
+ :disabled="fillMobile == 0"
|
|
|
+ :placeholder="fillMobile == 0 ? '' : '请填写手机号'"
|
|
|
+ />
|
|
|
+ <!-- #ifdef MP-WEIXIN -->
|
|
|
+ <button
|
|
|
+ v-if="fillMobile == 1"
|
|
|
+ class="apply-code-btn apply-fill-btn"
|
|
|
+ open-type="getPhoneNumber"
|
|
|
+ @getphonenumber="getSj"
|
|
|
+ >帮我填</button>
|
|
|
+ <button
|
|
|
+ v-else
|
|
|
+ class="apply-code-btn apply-cancel-btn"
|
|
|
+ @click="cancelAutoMobile"
|
|
|
+ >取消</button>
|
|
|
+ <!-- #endif -->
|
|
|
+ </tui-list-cell>
|
|
|
+ <tui-list-cell v-if="fillMobile == 1" class="line-cell code-wrap" :hover="false">
|
|
|
+ <view class="tui-title required">验证码</view>
|
|
|
+ <input v-model="form.authCode" type="number" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input tui-input--code" name="authCode" placeholder="请填写验证码" />
|
|
|
+ <button v-if="hasGet == false" class="apply-code-btn" @click="requestAuthCode()">获取</button>
|
|
|
+ <button v-else class="apply-code-btn apply-code-btn--disabled">{{ count }}</button>
|
|
|
+ </tui-list-cell>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <!-- 会员费、邀请码、减免、应付 -->
|
|
|
+ <view class="fee-card module-com apply-card">
|
|
|
+ <view class="fee-row">
|
|
|
+ <text class="fee-label">邀请码</text>
|
|
|
+ <input
|
|
|
+ v-model="form.inviteCode"
|
|
|
+ class="fee-input"
|
|
|
+ type="text"
|
|
|
+ placeholder="选填"
|
|
|
+ placeholder-class="phcolor"
|
|
|
+ placeholder-style="color:#CCCCCC"
|
|
|
+ @input="onInviteCodeInput"
|
|
|
+ @blur="onInviteCodeBlur"
|
|
|
+ @confirm="onInviteCodeBlur"
|
|
|
+ />
|
|
|
+ </view>
|
|
|
+ <view class="fee-row fee-row--border">
|
|
|
+ <text class="fee-label">会员费</text>
|
|
|
+ <text class="fee-value">¥{{ formatMoney(feePreview.price) }}</text>
|
|
|
+ </view>
|
|
|
+ <view v-if="feePreview.showInviteDiscount" class="fee-row fee-row--border">
|
|
|
+ <text class="fee-label fee-label--discount">邀请减免</text>
|
|
|
+ <text class="fee-value fee-value--discount">-¥{{ formatMoney(feePreview.hdDiscountAmount) }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="fee-row fee-row--border">
|
|
|
+ <text class="fee-label">应付金额</text>
|
|
|
+ <text class="fee-value fee-value--pay">¥{{ formatPayAmount(feePreview.payAmount) }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="module-com apply-card recommend-wrap" v-if="!$util.isEmpty(merchantData)">
|
|
|
+ <view class="recommend-tag">推荐人</view>
|
|
|
+ <view class="recommend-det">
|
|
|
+ <image class="recommend-avatar" mode="scaleToFill" :src="merchantData.logoUrl" @error="imageError" />
|
|
|
+ <view class="recommend-info">
|
|
|
+ <view class="app-size-32">{{ merchantData.name }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="apply-agreement">
|
|
|
+ <checkbox-group @change="agreeItem">
|
|
|
+ <label class="apply-agreement-label">
|
|
|
+ <checkbox value="1" class="apply-checkbox" :checked="agree == 1" />
|
|
|
+ <text class="apply-agreement-text">
|
|
|
+ 我已阅读并同意
|
|
|
+ <text class="apply-agreement-link" @click.stop="goToService()">《服务协议》</text>
|
|
|
+ 和
|
|
|
+ <text class="apply-agreement-link" @click.stop="goToPrivacy()">《隐私政策》</text>
|
|
|
+ </text>
|
|
|
+ </label>
|
|
|
+ </checkbox-group>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <view class="apply-submit-wrap">
|
|
|
+ <button class="apply-submit-btn" formType="submit">{{ submitBtnText }}</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onCityConfirm"></simple-address>
|
|
|
+ <app-area-sel :show.sync="showRegion" :city="form.city" :initial-list="addressInitialList" @change="changeAreaFn" />
|
|
|
+ </form>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import TuiListCell from "@/components/plugin/list-cell";
|
|
|
+import AppAreaSel from "@/components/app-area-sel";
|
|
|
+import SimpleAddress from "@/components/plugin/simple-address";
|
|
|
+import AppAvatarModule from "@/components/module/app-avatar";
|
|
|
+import AppUploader from "@/components/app-uploader";
|
|
|
+const form = require("@/utils/formValidation.js");
|
|
|
+import { getIntroduce, applyRegister, renewCreate, getRegisterFeePreview, getRegisterInviteContext, saveRegisterInvite } from '@/api/official'
|
|
|
+// #ifdef MP-WEIXIN || H5
|
|
|
+import wexinPay from '@/utils/pay/wxPay'
|
|
|
+// #endif
|
|
|
+import {getAuthCode} from "@/api/apply";
|
|
|
+import { mapGetters,mapActions } from "vuex"
|
|
|
+import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue'
|
|
|
+import { APIHOST } from '@/config'
|
|
|
+import { getShopInfo} from "@/utils/auth";
|
|
|
+import { getDictionaries } from '@/api/mini'
|
|
|
+import { checkShop } from '@/api/shop'
|
|
|
+import { ghsInfo } from "@/api/ghs/index";
|
|
|
+import { getMobile } from "@/api/auth";
|
|
|
+import { getHasMap } from "@/api/express"
|
|
|
+import { mapNearby } from '@/api/map/index'
|
|
|
+import { iconSrc } from '@/utils/iconSrc'
|
|
|
+import { persistInviteContext, tryBindPendingInvite, optionHasInviteContext, clearPendingInvite, restorePendingInviteFromLegacy, getRegisterInviteParams, expireInviteIfNeeded, getGhsProductQueryFromPending } from "@/utils/pendingGhsInvite";
|
|
|
+// #ifdef APP-PLUS
|
|
|
+import permision from "@/utils/wa-permission_1.1/permission.js";
|
|
|
+// #endif
|
|
|
+export default {
|
|
|
+ name: 'applyInvite',
|
|
|
+ components: {
|
|
|
+ TuiListCell,
|
|
|
+ AppAreaSel,
|
|
|
+ SimpleAddress,
|
|
|
+ AppAvatarModule,
|
|
|
+ AppUploader,
|
|
|
+ htzImageUpload
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ merchantData: {},
|
|
|
+ agree:0,
|
|
|
+ form: {
|
|
|
+ name: "",
|
|
|
+ mobile: "",
|
|
|
+ province: "",
|
|
|
+ city: "",
|
|
|
+ dist: "",
|
|
|
+ address: "",
|
|
|
+ adminName: '',
|
|
|
+ main: 1,
|
|
|
+ licenseNo: "",
|
|
|
+ license: "",
|
|
|
+ floor: "",
|
|
|
+ longitude: 0,
|
|
|
+ latitude: 0,
|
|
|
+ showAddress:"",
|
|
|
+ authCode:"",
|
|
|
+ cover:'',
|
|
|
+ inviteCode: ''
|
|
|
+ },
|
|
|
+ /** 注册费用预览(/apply/register-fee-preview) */
|
|
|
+ feePreview: {
|
|
|
+ price: 0,
|
|
|
+ memberTypeName: '年度会员',
|
|
|
+ inviteValid: 0,
|
|
|
+ inviteNotFound: 0,
|
|
|
+ hdDiscountAmount: 0,
|
|
|
+ showInviteDiscount: 0,
|
|
|
+ payAmount: 0
|
|
|
+ },
|
|
|
+ inviteCodePreviewTimer: null,
|
|
|
+ cityPickerValueDefault: [0, 0],
|
|
|
+ showRegion: false,
|
|
|
+ addressInitialList: [],
|
|
|
+ locating: false,
|
|
|
+ hasMap: 0,
|
|
|
+ adminName: "",
|
|
|
+ logo: '',
|
|
|
+ hasGet:false,
|
|
|
+ count:120,
|
|
|
+ INT:false,
|
|
|
+ headers:{token:''},
|
|
|
+ currentImgData: [],
|
|
|
+ isHd:1,
|
|
|
+ uploadImgUrl:APIHOST+'/upload/save-file',
|
|
|
+ fillMobile: 1,
|
|
|
+ /** 是否已开通 xhShop(已登录且有 currentShopId) */
|
|
|
+ hasShop: false,
|
|
|
+ /** 当前账号 xhApply.id,已开店支付时使用 */
|
|
|
+ applyId: 0,
|
|
|
+ shopBrief: {
|
|
|
+ name: '',
|
|
|
+ mobile: ''
|
|
|
+ },
|
|
|
+ /** 分享链接/启动参数带入的邀请码,优先级高于 xhApply */
|
|
|
+ inviteCodeFromLink: ''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ ...mapGetters(["getLoginInfo"]),
|
|
|
+ /** 提交按钮文案 */
|
|
|
+ submitBtnText () {
|
|
|
+ return this.hasShop ? '立即支付' : '确认注册'
|
|
|
+ },
|
|
|
+ /** 横幅背景图 */
|
|
|
+ memberBannerBg () {
|
|
|
+ const host = (this.$constant && this.$constant.imgUrl) || ''
|
|
|
+ return host ? host + '/hzg/invite/shop_invite_bg.png' : ''
|
|
|
+ },
|
|
|
+ /** 横幅展示整数价 */
|
|
|
+ priceInteger () {
|
|
|
+ const n = parseFloat(this.feePreview.price)
|
|
|
+ if (isNaN(n)) {
|
|
|
+ return '0'
|
|
|
+ }
|
|
|
+ return String(Math.round(n))
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad () {
|
|
|
+ expireInviteIfNeeded()
|
|
|
+ if (optionHasInviteContext(this.option)) {
|
|
|
+ persistInviteContext(this.option)
|
|
|
+ } else {
|
|
|
+ const legacyOption = uni.getStorageSync('ghsCgOption') || {}
|
|
|
+ const hadLegacy = !!(uni.getStorageSync('ghsCgScene') || legacyOption.shopId)
|
|
|
+ if (hadLegacy) {
|
|
|
+ restorePendingInviteFromLegacy()
|
|
|
+ } else {
|
|
|
+ clearPendingInvite()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const token = uni.getStorageSync('token')
|
|
|
+ this.headers.token = token
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ this.fillMobile = 1
|
|
|
+ // #endif
|
|
|
+ getHasMap().then(res => {
|
|
|
+ this.hasMap = res.data.hasMap
|
|
|
+ })
|
|
|
+ const linkCode = this.getLaunchInviteCode()
|
|
|
+ if (linkCode) {
|
|
|
+ this.inviteCodeFromLink = linkCode
|
|
|
+ this.form.inviteCode = linkCode
|
|
|
+ }
|
|
|
+ this.loadRegisterFeePreview(false)
|
|
|
+ this.loadRegisterInviteContext()
|
|
|
+ },
|
|
|
+ onUnload(){
|
|
|
+ clearInterval(this.INT)
|
|
|
+ this.clearInviteCodePreviewTimer()
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ if (uni.getStorageSync('token')) {
|
|
|
+ // 仅刷新门店上下文,不覆盖用户已改或链接带入的邀请码
|
|
|
+ this.loadRegisterInviteContext(true)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['setUserShopAll']),
|
|
|
+ iconSrc,
|
|
|
+ formatMoney (val) {
|
|
|
+ const n = parseFloat(val)
|
|
|
+ if (isNaN(n)) {
|
|
|
+ return '0'
|
|
|
+ }
|
|
|
+ if (Math.abs(n - Math.round(n)) < 0.001) {
|
|
|
+ return String(Math.round(n))
|
|
|
+ }
|
|
|
+ return n.toFixed(2)
|
|
|
+ },
|
|
|
+ formatPayAmount (val) {
|
|
|
+ const n = parseFloat(val)
|
|
|
+ if (isNaN(n)) {
|
|
|
+ return '0.00'
|
|
|
+ }
|
|
|
+ return n.toFixed(2)
|
|
|
+ },
|
|
|
+ /** 邀请码输入:1.5s 防抖后查费用预览 */
|
|
|
+ onInviteCodeInput () {
|
|
|
+ this.scheduleInviteCodePreview()
|
|
|
+ },
|
|
|
+ scheduleInviteCodePreview () {
|
|
|
+ this.clearInviteCodePreviewTimer()
|
|
|
+ this.inviteCodePreviewTimer = setTimeout(() => {
|
|
|
+ this.inviteCodePreviewTimer = null
|
|
|
+ this.loadRegisterFeePreview(true)
|
|
|
+ }, 1500)
|
|
|
+ },
|
|
|
+ clearInviteCodePreviewTimer () {
|
|
|
+ if (this.inviteCodePreviewTimer) {
|
|
|
+ clearTimeout(this.inviteCodePreviewTimer)
|
|
|
+ this.inviteCodePreviewTimer = null
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onInviteCodeBlur () {
|
|
|
+ this.clearInviteCodePreviewTimer()
|
|
|
+ this.loadRegisterFeePreview(true)
|
|
|
+ },
|
|
|
+ /** 读取页面启动参数中的 inviteCode */
|
|
|
+ getLaunchInviteCode () {
|
|
|
+ const code = (this.option && this.option.inviteCode) ? String(this.option.inviteCode).trim() : ''
|
|
|
+ return code
|
|
|
+ },
|
|
|
+ /** 按优先级回填邀请码:链接参数 > xhApply */
|
|
|
+ applyInviteCodeFromContext (applyInviteCode) {
|
|
|
+ if (this.inviteCodeFromLink) {
|
|
|
+ this.form.inviteCode = this.inviteCodeFromLink
|
|
|
+ } else if (applyInviteCode) {
|
|
|
+ this.form.inviteCode = applyInviteCode
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 拉取是否已开店及 xhApply 邀请快照;skipInviteFill 为 true 时不改邀请码输入框 */
|
|
|
+ async loadRegisterInviteContext (skipInviteFill) {
|
|
|
+ const token = uni.getStorageSync('token')
|
|
|
+ if (!token) {
|
|
|
+ this.hasShop = false
|
|
|
+ this.applyId = 0
|
|
|
+ return
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ const res = await getRegisterInviteContext()
|
|
|
+ if (res.code !== 1 || !res.data) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const d = res.data
|
|
|
+ this.hasShop = d.hasShop === 1
|
|
|
+ this.applyId = d.applyId || 0
|
|
|
+ this.shopBrief = {
|
|
|
+ name: d.shopName || '',
|
|
|
+ mobile: d.shopMobile || ''
|
|
|
+ }
|
|
|
+ if (!skipInviteFill) {
|
|
|
+ this.applyInviteCodeFromContext(d.inviteCode || '')
|
|
|
+ await this.loadRegisterFeePreview(false)
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ // 网络失败不打断填写
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 拉取会员费 / 邀请减免预览 */
|
|
|
+ async loadRegisterFeePreview (notifyInvalid) {
|
|
|
+ const code = (this.form.inviteCode || '').trim()
|
|
|
+ try {
|
|
|
+ const res = await getRegisterFeePreview({ inviteCode: code })
|
|
|
+ if (code !== (this.form.inviteCode || '').trim()) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.code === 1 && res.data) {
|
|
|
+ this.feePreview = { ...this.feePreview, ...res.data }
|
|
|
+ if (notifyInvalid && code !== '' && res.data.inviteNotFound) {
|
|
|
+ uni.showToast({ title: '邀请人不存在', icon: 'none' })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ // 网络失败不打断填写
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ensureAppLocationPermission() {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ if (plus.os.name === 'Android') {
|
|
|
+ const permissionRes = await permision.requestAndroidPermission('android.permission.ACCESS_FINE_LOCATION')
|
|
|
+ if (permissionRes !== 1) {
|
|
|
+ if (permissionRes === -1) {
|
|
|
+ permision.gotoAppPermissionSetting()
|
|
|
+ }
|
|
|
+ reject(new Error('请开启定位权限'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!permision.checkSystemEnableLocation()) {
|
|
|
+ reject(new Error('请先开启系统定位服务'))
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
+ resolve()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getDeviceLocation() {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const requestLocation = (locationType) => {
|
|
|
+ uni.getLocation({
|
|
|
+ type: locationType,
|
|
|
+ success: (res) => resolve({ ...res, locationType }),
|
|
|
+ fail: (err) => {
|
|
|
+ if (locationType === 'gcj02' && (
|
|
|
+ err.code == 18 ||
|
|
|
+ err.errCode == 18 ||
|
|
|
+ (err.errMsg && (
|
|
|
+ err.errMsg.indexOf('not support gcj02') > -1 ||
|
|
|
+ err.errMsg.indexOf('Not Support CoordsType') > -1
|
|
|
+ ))
|
|
|
+ )) {
|
|
|
+ requestLocation('wgs84')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ reject(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ if (plus.os.name === 'iOS') {
|
|
|
+ requestLocation('wgs84')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // #endif
|
|
|
+ requestLocation('gcj02')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ modifyShow(){
|
|
|
+ this.form.showAddress = this.form.city + this.form.address + this.form.floor
|
|
|
+ },
|
|
|
+ applyNearbyAddress(item) {
|
|
|
+ if (!item) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (item.district) {
|
|
|
+ this.form.dist = item.district
|
|
|
+ }
|
|
|
+ this.form.address = item.name || item.address || ''
|
|
|
+ this.form.showAddress = item.showAddress || item.address || ''
|
|
|
+ if (item.location) {
|
|
|
+ let lng = ''
|
|
|
+ let lat = ''
|
|
|
+ if (typeof item.location === 'object') {
|
|
|
+ lng = item.location.lng || item.location.longitude || ''
|
|
|
+ lat = item.location.lat || item.location.latitude || ''
|
|
|
+ } else {
|
|
|
+ const parts = String(item.location).split(',').map(v => v.trim())
|
|
|
+ if (parts.length >= 2) {
|
|
|
+ lng = parts[0]
|
|
|
+ lat = parts[1]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (lng && lat) {
|
|
|
+ this.form.longitude = lng
|
|
|
+ this.form.latitude = lat
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.modifyShow()
|
|
|
+ },
|
|
|
+ fillCityFromNearby(first) {
|
|
|
+ if (!first) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (first.province) {
|
|
|
+ this.form.province = first.province
|
|
|
+ }
|
|
|
+ if (first.city) {
|
|
|
+ this.form.city = first.city
|
|
|
+ }
|
|
|
+ if (first.district) {
|
|
|
+ this.form.dist = first.district
|
|
|
+ }
|
|
|
+ this.modifyShow()
|
|
|
+ },
|
|
|
+ async loadNearbyAddressList(fillCity) {
|
|
|
+ if (this.locating) {
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ this.locating = true
|
|
|
+ uni.showLoading({ title: fillCity ? '定位中' : '加载中', mask: true })
|
|
|
+ try {
|
|
|
+ await this.ensureAppLocationPermission()
|
|
|
+ const location = await this.getDeviceLocation()
|
|
|
+ const res = await mapNearby({
|
|
|
+ lat: location.latitude,
|
|
|
+ long: location.longitude,
|
|
|
+ locationType: location.locationType || 'gcj02'
|
|
|
+ })
|
|
|
+ if (res.code != 1 || !res.data || !res.data.list || res.data.list.length === 0) {
|
|
|
+ if (fillCity) {
|
|
|
+ this.$msg('未获取到位置,请手动选择城市')
|
|
|
+ }
|
|
|
+ return []
|
|
|
+ }
|
|
|
+ const list = res.data.list
|
|
|
+ if (fillCity) {
|
|
|
+ this.fillCityFromNearby(list[0])
|
|
|
+ }
|
|
|
+ this.addressInitialList = list
|
|
|
+ return list
|
|
|
+ } catch (err) {
|
|
|
+ console.log('loadNearbyAddressList fail', err)
|
|
|
+ if (fillCity) {
|
|
|
+ this.$msg((err && err.message) ? err.message : '定位失败,请手动填写')
|
|
|
+ }
|
|
|
+ return []
|
|
|
+ } finally {
|
|
|
+ this.locating = false
|
|
|
+ uni.hideLoading()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async locateCity() {
|
|
|
+ const list = await this.loadNearbyAddressList(true)
|
|
|
+ if (list.length > 0) {
|
|
|
+ this.$msg('已定位到当前城市')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onHere(){
|
|
|
+ this.form.province = '云南省'
|
|
|
+ this.form.city = '昆明市'
|
|
|
+ },
|
|
|
+ cancelAutoMobile() {
|
|
|
+ this.$util.confirmModal({
|
|
|
+ content: '取消后将清空已获取的手机号,需重新填写并验证,是否确认?',
|
|
|
+ okText: '确认取消',
|
|
|
+ cancelText: '暂不取消'
|
|
|
+ }, () => {
|
|
|
+ this.resetAutoMobile()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resetAutoMobile() {
|
|
|
+ this.fillMobile = 1
|
|
|
+ this.form.mobile = ''
|
|
|
+ this.form.authCode = ''
|
|
|
+ if (this.INT) {
|
|
|
+ clearInterval(this.INT)
|
|
|
+ this.INT = false
|
|
|
+ }
|
|
|
+ this.hasGet = false
|
|
|
+ this.count = 120
|
|
|
+ },
|
|
|
+ onNameBlur(e) {
|
|
|
+ if (e.detail && typeof e.detail.value === 'string') {
|
|
|
+ this.form.adminName = e.detail.value.trim()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onNameInput(e) {
|
|
|
+ if (e.detail && typeof e.detail.value === 'string') {
|
|
|
+ this.form.adminName = e.detail.value.trim()
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getSj(e){
|
|
|
+ let that = this
|
|
|
+ let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ if (e.detail.errMsg === "getPhoneNumber:ok") {
|
|
|
+ getMobile({ iv: e.detail.iv, encryptedData: e.detail.encryptedData,miniOpenId:currentMiniOpenId }).then(subRes => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if(subRes.data.mobile && subRes.data.mobile!=''){
|
|
|
+ this.form.mobile = subRes.data.mobile
|
|
|
+ this.fillMobile = 0
|
|
|
+ this.form.authCode = ''
|
|
|
+ this.checkShopFn({detail:{value:this.form.mobile}})
|
|
|
+ }else{
|
|
|
+ this.$msg("没获取到手机号")
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$msg("获取失败")
|
|
|
+ }
|
|
|
+ },
|
|
|
+ checkShopFn(val){
|
|
|
+ // #ifdef MP-WEIXIN
|
|
|
+ let that = this
|
|
|
+ checkShop({mobile:val.detail.value}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ if(res.data.has == 1){
|
|
|
+ that.$util.confirmModal({content:'此手机号已注册(可能由批发店添加),您可直接登录',okText:'去登录'},() => {
|
|
|
+ that.pageTo({url: '/admin/home/login'})
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ },
|
|
|
+ goToService(){
|
|
|
+ this.$util.pageTo({ url: "/admin/home/register"})
|
|
|
+ },
|
|
|
+ goToPrivacy(){
|
|
|
+ this.$util.pageTo({ url: "/admin/home/privacy"})
|
|
|
+ },
|
|
|
+ agreeItem(e){
|
|
|
+ this.agree = e.detail.value && e.detail.value.length > 0 ? 1 : 0
|
|
|
+ },
|
|
|
+ requestAuthCode(){
|
|
|
+ let that = this
|
|
|
+ let mobile = this.form.mobile
|
|
|
+ if(this.$util.checkMobile(mobile) == false){
|
|
|
+ this.$msg('请输入正确手机号')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ getAuthCode({mobile}).then(res=>{
|
|
|
+ if(res.code == 1){
|
|
|
+ that.hasGet = true
|
|
|
+ that.count = 120
|
|
|
+ that.INT = setInterval(function(){
|
|
|
+ if(that.count <= 0){
|
|
|
+ clearInterval(that.INT)
|
|
|
+ that.hasGet = false
|
|
|
+ that.count = 120
|
|
|
+ return
|
|
|
+ }
|
|
|
+ that.count--
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ resultData (val) {
|
|
|
+ this.form.license = val.shortUrl
|
|
|
+ },
|
|
|
+ _resultData (val) {
|
|
|
+ this.form.logo = val.shortUrl
|
|
|
+ },
|
|
|
+ changeMain (val) {
|
|
|
+ this.form.main = val
|
|
|
+ },
|
|
|
+ bindInfo (val) {
|
|
|
+ this.form.adminName = val.name;
|
|
|
+ this.form.mobile = val.mobile
|
|
|
+ },
|
|
|
+ init () {
|
|
|
+ this._getMerchantDet()
|
|
|
+ },
|
|
|
+ _getMerchantDet () {
|
|
|
+ getIntroduce(this.option).then(res => {
|
|
|
+ this.merchantData = res.data.introduce
|
|
|
+ });
|
|
|
+ },
|
|
|
+ openAddres () {
|
|
|
+ this.$refs.simpleAddress.open();
|
|
|
+ },
|
|
|
+ onCityConfirm (e) {
|
|
|
+ this.form.province = e.provinceName;
|
|
|
+ this.form.city = e.cityName;
|
|
|
+ this.addressInitialList = []
|
|
|
+ this.modifyShow()
|
|
|
+ },
|
|
|
+ imgUploadSuccess(res) {
|
|
|
+ var _res = JSON.parse(res.data)
|
|
|
+ if(_res.code == 1){
|
|
|
+ this.currentImgData.push(_res.data.smallUrl)
|
|
|
+ this.form.cover = _res.data.shortUrl
|
|
|
+ }
|
|
|
+ },
|
|
|
+ imgDeleteFn(res){
|
|
|
+ this.form.cover=''
|
|
|
+ },
|
|
|
+ selectRegion() {
|
|
|
+ if (!this.form.city) {
|
|
|
+ this.$msg('请先选择城市或点击定位图标')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.openAddressSelector()
|
|
|
+ },
|
|
|
+ async openAddressSelector() {
|
|
|
+ if (!this.addressInitialList || this.addressInitialList.length === 0) {
|
|
|
+ await this.loadNearbyAddressList(false)
|
|
|
+ }
|
|
|
+ this.showRegion = true
|
|
|
+ },
|
|
|
+ changeAreaFn(e) {
|
|
|
+ this.applyNearbyAddress(e)
|
|
|
+ },
|
|
|
+ modifyShow(){
|
|
|
+ this.form.showAddress = this.form.city + this.form.address + this.form.floor
|
|
|
+ },
|
|
|
+ formSubmit (e) {
|
|
|
+ if (this.hasShop) {
|
|
|
+ this.formSubmitPayOnly()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let rules = [
|
|
|
+ { name: "name", rule: ["required"], msg: ["请填写名称"] },
|
|
|
+ { name: "city", rule: ["required"], msg: ["请选择城市"] },
|
|
|
+ { name: "address", rule: ["required"], msg: ["请填写地址"] },
|
|
|
+ { name: "adminName", rule: ["required"], msg: ["请填写姓名"] },
|
|
|
+ { name: "mobile", rule: ["required"], msg: ["请填写手机号"] }
|
|
|
+ ];
|
|
|
+ let formData = this.form;
|
|
|
+ let checkRes = form.validation(formData, rules)
|
|
|
+
|
|
|
+ if(this.agree == 0){
|
|
|
+ this.$util.confirmModal({
|
|
|
+ content:'请阅读并同意服务协议和隐私政策',
|
|
|
+ okText:'同意',
|
|
|
+ cancelText:'不同意'
|
|
|
+ },() => {
|
|
|
+ this.agree = 1
|
|
|
+ if (!checkRes) {
|
|
|
+ if (this.fillMobile == 1 && !this.form.authCode) {
|
|
|
+ this.$msg('请填写验证码')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.showLoading({mask:true})
|
|
|
+ setTimeout(() => {
|
|
|
+ this.confirmFn()
|
|
|
+ })
|
|
|
+ uni.hideLoading()
|
|
|
+ } else {
|
|
|
+ this.$msg(checkRes);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!checkRes) {
|
|
|
+ if (this.fillMobile == 1 && !this.form.authCode) {
|
|
|
+ this.$msg('请填写验证码')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.showLoading({mask:true})
|
|
|
+ setTimeout(() => {
|
|
|
+ this.confirmFn()
|
|
|
+ })
|
|
|
+ uni.hideLoading()
|
|
|
+ } else {
|
|
|
+ this.$msg(checkRes);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 已开店:仅校验协议与邀请码后支付 */
|
|
|
+ formSubmitPayOnly () {
|
|
|
+ const inviteCode = (this.form.inviteCode || '').trim()
|
|
|
+ if (inviteCode !== '' && this.feePreview.inviteNotFound) {
|
|
|
+ this.$msg('邀请人不存在')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (this.agree == 0) {
|
|
|
+ this.$util.confirmModal({
|
|
|
+ content: '请阅读并同意服务协议和隐私政策',
|
|
|
+ okText: '同意',
|
|
|
+ cancelText: '不同意'
|
|
|
+ }, () => {
|
|
|
+ this.agree = 1
|
|
|
+ this.confirmPayOnly()
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.confirmPayOnly()
|
|
|
+ },
|
|
|
+ /** 已开店:保存邀请码并唤起支付 */
|
|
|
+ confirmPayOnly () {
|
|
|
+ const that = this
|
|
|
+ const inviteCode = (this.form.inviteCode || '').trim()
|
|
|
+ if (inviteCode !== '' && this.feePreview.inviteNotFound) {
|
|
|
+ this.$msg('邀请人不存在')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.showLoading({ mask: true })
|
|
|
+ saveRegisterInvite({ inviteCode }).then(res => {
|
|
|
+ if (res.code != 1 || that.$util.isEmpty(res.data)) {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.$msg(res.msg || '出错了')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const d = res.data
|
|
|
+ that.applyId = d.applyId || that.applyId
|
|
|
+ that.feePreview = { ...that.feePreview, ...d }
|
|
|
+ that.startPayFlow(that.applyId)
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 本页创建续费订单并唤起微信支付 */
|
|
|
+ startPayFlow (applyId) {
|
|
|
+ const that = this
|
|
|
+ const currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ const payAmount = parseFloat(that.feePreview.payAmount)
|
|
|
+ if (isNaN(payAmount) || payAmount <= 0) {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.handlePayComplete()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.showLoading({ title: '正在创建订单', mask: true })
|
|
|
+ renewCreate({
|
|
|
+ applyId: applyId || 0,
|
|
|
+ miniOpenId: currentMiniOpenId
|
|
|
+ }).then(payRes => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if (payRes.code != 1 || that.$util.isEmpty(payRes.data)) {
|
|
|
+ that.$msg(payRes.msg || '创建订单失败')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const payData = payRes.data
|
|
|
+ if (payData.needPay == 0 || payData.paid == 1) {
|
|
|
+ that.handlePayComplete()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // #ifdef MP-WEIXIN || H5
|
|
|
+ uni.showLoading({ title: '正在调起支付', mask: true })
|
|
|
+ wexinPay(payData, () => {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.handlePayComplete()
|
|
|
+ }, () => {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.$msg('支付已取消')
|
|
|
+ })
|
|
|
+ // #endif
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ that.$msg('请在微信小程序内完成会员支付')
|
|
|
+ // #endif
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ that.$msg('创建订单失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 支付/0 元开通完成:本页提示后返回,不跳转结果页 */
|
|
|
+ handlePayComplete () {
|
|
|
+ const that = this
|
|
|
+ tryBindPendingInvite().then(() => {
|
|
|
+ uni.showToast({ title: '开通成功', icon: 'success', duration: 2000 })
|
|
|
+ setTimeout(() => {
|
|
|
+ const pages = getCurrentPages()
|
|
|
+ if (pages.length > 1) {
|
|
|
+ uni.navigateBack()
|
|
|
+ } else {
|
|
|
+ that.$util.pageTo({ url: '/admin/cg/me', type: 2 })
|
|
|
+ }
|
|
|
+ }, 1500)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 写入登录态(不跳转) */
|
|
|
+ setupLoginState (data) {
|
|
|
+ const that = this
|
|
|
+ const token = data.token || ''
|
|
|
+ if (that.$util.isEmpty(token)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.setStorageSync('token', token)
|
|
|
+ uni.setStorageSync('shopId', (data.admin && data.admin.currentShopId) || data.shopId)
|
|
|
+ getDictionaries({ token }).then(res => {
|
|
|
+ if (that.$util.isEmpty(res)) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
+ that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
+ })
|
|
|
+ that.$store.commit('setLoginInfo', { ...data.admin, ...data })
|
|
|
+ getShopInfo(true).then(res => {
|
|
|
+ uni.setNavigationBarTitle({ title: res.name })
|
|
|
+ })
|
|
|
+ that.setUserShopAll()
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ that.$util.afterAppLoginSuccess({ auto: 0 })
|
|
|
+ // #endif
|
|
|
+ return true
|
|
|
+ },
|
|
|
+ /** 注册完成后的页面跳转 */
|
|
|
+ goAfterRegister () {
|
|
|
+ const that = this
|
|
|
+ const registerInviteQuery = getGhsProductQueryFromPending()
|
|
|
+ const navigate = () => {
|
|
|
+ if (this.option.fromType && this.option.fromType == 2) {
|
|
|
+ this.$util.pageTo({ url: '/admin/ll/list', type: 2 })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.option.itemId && Number(this.option.itemId) > 0 && this.option.ghsShopId && Number(this.option.ghsShopId) > 0) {
|
|
|
+ ghsInfo({ shopId: this.option.ghsShopId }).then(resInfo => {
|
|
|
+ const ghsId = resInfo.data.id
|
|
|
+ if (Number(ghsId) > 0) {
|
|
|
+ that.$util.pageTo({ url: '/admin/ghsProduct/detail?id=' + that.option.itemId + '&ghsId=' + ghsId, type: 2 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (registerInviteQuery) {
|
|
|
+ this.$util.pageTo({ url: '/pagesClient/official/result', query: registerInviteQuery, type: 2 })
|
|
|
+ } else {
|
|
|
+ this.$util.pageTo({ url: '/pagesClient/official/result', type: 2 })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tryBindPendingInvite().then(() => {
|
|
|
+ navigate()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 注册成功后的登录与跳转(免支付) */
|
|
|
+ handleRegisterLogin (data) {
|
|
|
+ if (!this.setupLoginState(data)) {
|
|
|
+ this.$msg('出错了')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.goAfterRegister()
|
|
|
+ },
|
|
|
+ confirmFn () {
|
|
|
+ restorePendingInviteFromLegacy()
|
|
|
+ const inviteParams = getRegisterInviteParams(this.option)
|
|
|
+ const inviteCode = (this.form.inviteCode || '').trim()
|
|
|
+ if (inviteCode !== '' && this.feePreview.inviteNotFound) {
|
|
|
+ this.$msg('邀请人不存在')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ uni.showLoading({ mask: true })
|
|
|
+ const currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
|
|
|
+ const style = this.option.style || 0
|
|
|
+ const from = this.option.from || 0
|
|
|
+ const that = this
|
|
|
+ this.form.showAddress = this.form.city + this.form.address + this.form.floor
|
|
|
+ let appRegister = 0
|
|
|
+ // #ifdef APP-PLUS
|
|
|
+ appRegister = 1
|
|
|
+ // #endif
|
|
|
+ applyRegister({
|
|
|
+ hdShopAdminId: inviteParams.hdShopAdminId,
|
|
|
+ ghsShopAdminId: inviteParams.ghsShopAdminId,
|
|
|
+ inviteGhsShopId: inviteParams.inviteGhsShopId,
|
|
|
+ inviteCode,
|
|
|
+ ...this.form,
|
|
|
+ style,
|
|
|
+ from,
|
|
|
+ miniOpenId: currentMiniOpenId,
|
|
|
+ appRegister,
|
|
|
+ fillMobile: this.fillMobile
|
|
|
+ }).then(subRes => {
|
|
|
+ uni.hideLoading()
|
|
|
+ if (subRes.code != 1 || that.$util.isEmpty(subRes.data)) {
|
|
|
+ that.$msg(subRes.msg || '出错了')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const regData = subRes.data
|
|
|
+ if (!that.setupLoginState(regData)) {
|
|
|
+ that.$msg('出错了')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const applyId = regData.applyId || 0
|
|
|
+ that.startPayFlow(applyId)
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.apply-page {
|
|
|
+ min-height: 100vh;
|
|
|
+ background: #f2f7f4;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-body {
|
|
|
+ padding: 24upx 24upx 48upx;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner {
|
|
|
+ position: relative;
|
|
|
+ min-height: 200upx;
|
|
|
+ margin-bottom: 24upx;
|
|
|
+ padding: 32upx 28upx;
|
|
|
+ border-radius: 20upx;
|
|
|
+ overflow: hidden;
|
|
|
+ background: #f4faf6;
|
|
|
+ box-shadow: 0 8upx 24upx rgba(9, 197, 103, 0.08);
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-bg {
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-text {
|
|
|
+ position: relative;
|
|
|
+ z-index: 1;
|
|
|
+ max-width: 420upx;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-title {
|
|
|
+ font-size: 36upx;
|
|
|
+ font-weight: 800;
|
|
|
+ color: #161819;
|
|
|
+ line-height: 50upx;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-price-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: baseline;
|
|
|
+ margin-top: 24upx;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-yen {
|
|
|
+ font-size: 36upx;
|
|
|
+ font-weight: 700;
|
|
|
+ color: #09c567;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-price {
|
|
|
+ margin-left: 4upx;
|
|
|
+ font-size: 56upx;
|
|
|
+ font-weight: 800;
|
|
|
+ color: #09c567;
|
|
|
+ line-height: 1;
|
|
|
+}
|
|
|
+
|
|
|
+.member-banner-unit {
|
|
|
+ margin-left: 4upx;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #6b737c;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-card {
|
|
|
+ margin-bottom: 24upx;
|
|
|
+ padding: 8upx 32upx;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-row {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ min-height: 88upx;
|
|
|
+ padding: 12upx 0;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-row--border {
|
|
|
+ border-top: 1upx solid #eef1f5;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-label {
|
|
|
+ flex-shrink: 0;
|
|
|
+ color: #5c6673;
|
|
|
+ font-size: 28upx;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-label--discount {
|
|
|
+ color: #09c567;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-input {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ margin-left: 24upx;
|
|
|
+ text-align: right;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #161819;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-value {
|
|
|
+ color: #161819;
|
|
|
+ font-size: 28upx;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-value--discount {
|
|
|
+ color: #09c567;
|
|
|
+}
|
|
|
+
|
|
|
+.fee-value--pay {
|
|
|
+ color: #09c567;
|
|
|
+ font-size: 32upx;
|
|
|
+ font-weight: 700;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-section {
|
|
|
+ margin-bottom: 24upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-section-title {
|
|
|
+ margin-bottom: 16upx;
|
|
|
+ padding-left: 8upx;
|
|
|
+ color: #161819;
|
|
|
+ font-size: 30upx;
|
|
|
+ font-weight: 700;
|
|
|
+ line-height: 42upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-card {
|
|
|
+ margin-bottom: 0;
|
|
|
+ border-radius: 20upx;
|
|
|
+ overflow: hidden;
|
|
|
+ box-shadow: 0 8upx 24upx rgba(9, 197, 103, 0.08);
|
|
|
+}
|
|
|
+
|
|
|
+.module-com {
|
|
|
+ background-color: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-mode-btns {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ height: 64upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-mode-btn {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ height: 64upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ margin: 0;
|
|
|
+ padding: 0 24upx;
|
|
|
+ line-height: 64upx;
|
|
|
+ text-align: center;
|
|
|
+ color: #6b737c;
|
|
|
+ font-size: 26upx;
|
|
|
+ font-weight: 600;
|
|
|
+ border-radius: 999upx;
|
|
|
+ background: #f2f7f4;
|
|
|
+ border: 1upx solid #e3ebe6;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-mode-btn--last {
|
|
|
+ margin-left: 16upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-mode-btn--active {
|
|
|
+ color: #fff;
|
|
|
+ background: #09c567;
|
|
|
+ border-color: #09c567;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+
|
|
|
+.line-cell--city {
|
|
|
+ .city-row-main {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .city-locate-btn {
|
|
|
+ flex-shrink: 0;
|
|
|
+ width: 72upx;
|
|
|
+ height: 72upx;
|
|
|
+ margin-left: 12upx;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ border-radius: 50%;
|
|
|
+ background: #e8f8f0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .city-locate-icon {
|
|
|
+ width: 40upx;
|
|
|
+ height: 40upx;
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.line-cell {
|
|
|
+ .tui-title {
|
|
|
+ width: 180upx;
|
|
|
+ color: #5c6673;
|
|
|
+ font-size: 28upx;
|
|
|
+ }
|
|
|
+ .tui-input {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ width: auto;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #161819;
|
|
|
+ }
|
|
|
+ .tui-placeholder {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+ .phcolor {
|
|
|
+ color: #ccc;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.code-wrap {
|
|
|
+ .tui-input--code {
|
|
|
+ margin-right: 16upx;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.mobile-wrap {
|
|
|
+ .tui-input--filled {
|
|
|
+ color: #161819;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.apply-fill-btn {
|
|
|
+ min-width: 120upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-cancel-btn {
|
|
|
+ min-width: 120upx;
|
|
|
+ color: #6b737c;
|
|
|
+ background: #f2f7f4;
|
|
|
+ border: 1upx solid #e3ebe6;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-code-btn {
|
|
|
+ flex-shrink: 0;
|
|
|
+ min-width: 140upx;
|
|
|
+ height: 64upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+ margin: 0;
|
|
|
+ padding: 0 24upx;
|
|
|
+ line-height: 64upx;
|
|
|
+ border: none;
|
|
|
+ border-radius: 999upx;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 26upx;
|
|
|
+ font-weight: 600;
|
|
|
+ background: #09c567;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-code-btn::after {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-code-btn--disabled {
|
|
|
+ color: #8a9199;
|
|
|
+ background: #eef1f5;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-agreement {
|
|
|
+ margin-top: 8upx;
|
|
|
+ padding: 0 8upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-agreement-label {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-checkbox {
|
|
|
+ transform: scale(0.82);
|
|
|
+ flex-shrink: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-agreement-text {
|
|
|
+ flex: 1;
|
|
|
+ margin-left: 8upx;
|
|
|
+ color: #8a9199;
|
|
|
+ font-size: 26upx;
|
|
|
+ line-height: 36upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-agreement-link {
|
|
|
+ color: #09c567;
|
|
|
+ font-weight: 600;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-submit-wrap {
|
|
|
+ margin-top: 40upx;
|
|
|
+ padding: 0 8upx;
|
|
|
+}
|
|
|
+
|
|
|
+.apply-submit-btn {
|
|
|
+ width: 100%;
|
|
|
+ height: 96upx;
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+ line-height: 96upx;
|
|
|
+ border: none;
|
|
|
+ border-radius: 999upx;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 32upx;
|
|
|
+ font-weight: 600;
|
|
|
+ text-align: center;
|
|
|
+ background: #09c567;
|
|
|
+ box-shadow: 0 10upx 24upx rgba(9, 197, 103, 0.24);
|
|
|
+}
|
|
|
+
|
|
|
+.apply-submit-btn::after {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+
|
|
|
+.recommend-wrap {
|
|
|
+ padding: 28upx 32upx;
|
|
|
+ margin-bottom: 24upx;
|
|
|
+ .recommend-tag {
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #5c6673;
|
|
|
+ font-weight: 600;
|
|
|
+ margin-bottom: 20upx;
|
|
|
+ }
|
|
|
+ .recommend-det {
|
|
|
+ @include disFlex(center, flex-start);
|
|
|
+ .recommend-avatar {
|
|
|
+ width: 90upx;
|
|
|
+ height: 90upx;
|
|
|
+ border-radius: 45upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ }
|
|
|
+ .recommend-info {
|
|
|
+ margin-left: 20upx;
|
|
|
+ .app-size-32 {
|
|
|
+ margin-bottom: 4upx;
|
|
|
+ color: #161819;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|