123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- <template>
- <view>
- <u-card :border="false" padding="30" box-shadow="0px 1px 10px rgba(0,0,0,0.2)" border-radius="20" :show-foot="false">
- <view slot="head">
- <view class="u-flex">
- <view style="width: 8rpx;height: 34rpx;background: #0292FD;margin-right:20rpx;"></view>
- {{$t('register_2.cardtitle')}}
- </view>
- </view>
- <view slot="body">
- <u-form :model="form" ref="uForm">
- <u-form-item prop="store">
- <view style="margin-right: 10rpx;">
- <u-icon name="home" size="36"></u-icon>
- </view>
- <view style="margin-right: 10rpx;">{{$t('register_2.storeText')}}</view>
- <u-input v-model="form.store" :placeholder="this.$t('register_2.store')" />
- </u-form-item>
- <u-form-item prop="company">
- <view style="margin-right: 10rpx;">
- <u-icon name="home" size="36"></u-icon>
- </view>
- <view style="margin-right: 10rpx;">{{$t('register_2.companyText')}}</view>
- <u-input v-model="form.company" :placeholder="this.$t('register_2.company')" :disabled="true" />
- <view style="font-size: 16rpx;color: red;">
- {{$t('register_2.notwrite')}}
- </view>
- </u-form-item>
- <u-form-item prop="name">
- <view style="margin-right: 10rpx;">
- <u-icon name="account" size="36"></u-icon>
- </view>
- <u-input v-model="form.name" placeholder="this.$t('register_2.name')" />
- </u-form-item>
- <u-form-item prop="phone">
- <view style="margin-right: 10rpx;">
- <u-icon name="phone" size="36"></u-icon>
- </view>
- <u-input v-model="form.phone" :placeholder="this.$t('register_2.phone')" type="number" />
- </u-form-item>
- <u-form-item prop="code">
- <view style="margin-right: 10rpx;">
- <u-icon name="lock" size="36"></u-icon>
- </view>
- <u-input v-model="form.code" placeholder="请输入验证码" type="number" maxlength="6"/>
- <view class="" slot="right">
- <u-button size="mini" type="primary" @click="getCode" shape="circle" :loading="codeLoading">{{codeText}}</u-button>
- </view>
- </u-form-item>
- <u-form-item prop="region">
- <view style="margin-right: 10rpx;">
- <u-icon name="map" size="36"></u-icon>
- </view>
- <u-input placeholder="点击选择省市区" v-model="form.region" :disabled="true" @click="inMap"></u-input>
- <view class="" slot="right">
- <u-icon name="arrow-right" color="#666666" size="36"></u-icon>
- </view>
- </u-form-item>
- <u-form-item prop="addressInfo">
- <view style="margin-right: 10rpx;">
- <u-icon name="map" size="36"></u-icon>
- </view>
- <u-input placeholder="点击选择详细地址" v-model="form.addressInfo" :disabled="true" @click="inMap"></u-input>
- <view class="" slot="right">
- <u-icon name="arrow-right" color="#666666" size="36"></u-icon>
- </view>
- </u-form-item>
- </u-form>
- <u-verification-code ref="uCode" @change="codeChange"></u-verification-code>
- </view>
- </u-card>
- <view style="margin: 30rpx;">
- <u-button @click="nextStep" type="primary">下一步</u-button>
- </view>
- <u-modal v-model="modelshow" :content="modelcontent" title="温馨提示"></u-modal>
- </view>
- </template>
- <script>
- import {
- request
- } from '../../common/request/request'
- require("promise.prototype.finally").shim()
- export default {
- data() {
- return {
- codeText: '',
- form: {
- store: '',
- company: '',
- name: "",
- phone: "",
- code: '',
- region: '',
- latitude: '',
- longitude: '',
- province: "",
- city: "",
- district: "",
- addressInfo: ""
- },
- rules: {
- store: [{
- required: true,
- message: '请输入门店名称',
- trigger: 'blur,change'
- },
- {
- pattern: /^[\u4e00-\u9fa5_a-zA-Z()()0-9]+$/g,
- // 正则检验前先将值转为字符串
- transform(value) {
- return String(value);
- },
- message: '门店名称必须为中文或英语、数字',
- // 触发器可以同时用blur和change,二者之间用英文逗号隔开
- trigger: ['change', 'blur'],
- },
- ],
- company: [{
- required: true,
- message: '请输入公司名称',
- trigger: 'blur,change'
- }],
- name: [{
- required: true,
- message: '请输入联系人',
- trigger: 'blur,change'
- }, {
- min: 2,
- message: '姓名长度至少在2个字符以上',
- trigger: ['change', 'blur'],
- },
- {
- // 此为同步验证,可以直接返回true或者false,如果是异步验证,稍微不同,见下方说明
- pattern: /^[\u4e00-\u9fa5_a-zA-Z ]+$/g,
- // 正则检验前先将值转为字符串
- transform(value) {
- return String(value);
- },
- message: '姓名必须为中文或英文',
- // 触发器可以同时用blur和change,二者之间用英文逗号隔开
- trigger: ['change', 'blur'],
- }
- ],
- phone: [{
- required: true,
- message: '请输入联系电话',
- trigger: 'blur,change'
- },
- {
- validator: (rule, value, callback) => {
- // 调用uView自带的js验证规则,详见:https://www.uviewui.com/js/test.html
- return this.$u.test.mobile(value);
- },
- message: '手机号码不正确',
- // 触发器可以同时用blur和change,二者之间用英文逗号隔开
- trigger: ['change', 'blur'],
- }
- ],
- code: [{
- required: true,
- message: '请输入验证码',
- trigger: 'blur,change'
- },
- {
- min: 6,
- max: 6,
- message: '验证码为6位数',
- trigger: 'change',
- },
- {
- type: 'number',
- message: '验证码只能为数字',
- trigger: ['change', 'blur'],
- }
- ],
- region: [{
- required: true,
- message: '请选择地区',
- trigger: 'change',
- }],
- addressInfo: [{
- required: true,
- message: '请选择地区',
- trigger: 'change',
- }],
- },
- dataUrl: "",
- codeLoading: false,
- modelshow: false,
- modelcontent: "如果店名和联系人与营业执照不一致,请重新上传清晰度更高的营业执照。",
- lonlatData:'',
- bd09:false
- };
- },
- created() {
- uni.$on('licenseData', (data) => {
- if (data.company.words != "无") {
- this.form.store = data.company.words
- }
- this.form.company = data.company.words
- if (data.person.words != "无") {
- this.form.name = data.person.words
- }
- })
- uni.$on('addressData', (data) => {
- if(data.latitude&&data.longitude){
- request({
- url: '/baseReq/getBaiDuMapMsg',
- method: 'get',
- params: {
- "longitude": data.longitude,
- "latitude": data.latitude
- },
- }).then(res => {
- if (res.data.code == 0) {
- this.lonlatData=res.data.data.result
- this.bd09=true
- }
- if (res.data.code == 500) {
- this.$u.toast(res.data.msg);
- }
- }).catch(err => {
-
- }).finally(() => {
- })
- }
- this.address = data.address
- this.form.region = this.address.province + "-" + this.address.city + "-" + this.address.district
- this.form.addressInfo = this.address.addressInfo
- this.form.province = this.address.province;
- this.form.city = this.address.city;
- this.form.district = this.address.district;
- })
- uni.$on('dataUrl', (data) => {
- this.dataUrl = data
- })
- uni.getSystemInfo({
- success: res => {
- this.SystemInfo = res
- }
- });
- if (this.SystemInfo.platform == 'ios') {
- uni.showModal({
- title: "温馨提示",
- content: "如果店名和联系人与营业执照不一致,请重新上传清晰度更高的营业执照。",
- confirmText: "确认",
- showCancel: false
- })
- } else {
- this.modelshow= true
- }
- },
- methods: {
- nextStep() {
- this.form.latitude = this.lonlatData.y
- this.form.longitude = this.lonlatData.x
- this.$refs.uForm.validate(valid => {
- if (valid) {
- if(!this.bd09){
- this.$u.toast('正在转换坐标,请稍候');
- return
- }
- this.$u.route({
- url: 'pages/login/register_3',
- })
- uni.$emit("formData", {
- formData: this.form,
- dataUrl: this.dataUrl
- })
- } else {
-
- }
- });
- },
- codeChange(text) {
- this.codeText = text;
- },
- getCode() {
- if (this.$u.test.mobile(this.form.phone)) {
- if (this.$refs.uCode.canGetCode) {
- this.codeLoading = true
- request({
- url: '/sailun/appStoreBasicInfo/sendCode',
- method: 'post',
- data: {
- "phoneNumber": parseInt(this.form.phone),
- "opreaType": "0"
- },
- }).then(res => {
- if (res.data.code == 0) {
- this.$refs.uCode.start();
- }
- if (res.data.code == 500) {
- this.$u.toast(res.data.msg);
- }
- }).catch(err => {
-
- }).finally(() => {
- this.codeLoading = false
- // 通知验证码组件内部开始倒计时
- })
- } else {
- this.$u.toast('倒计时结束后再发送');
- }
- } else {
- this.$u.toast('请输入手机号');
- }
- },
- inMap() {
- this.bd09=false
- this.$u.route({
- url: 'pages/login/register_map'
- })
- }
- },
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- }
- }
- </script>
- <style lang="scss" scoped>
- .label-style {
- font-size: 10rpx;
- color: #F2F2F2;
- }
- </style>
|