123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- <template>
- <view class="shop_info">
- <view class="base_info" v-if="statusShow == 0">
- <view class="title">基本信息</view>
- <view class="info">
- <view class="flexB">
- <view class="label">店铺头像:</view>
- <view class="flexS">
- <image :src="info.img"></image>
- </view>
- </view>
- <view class="flexB">
- <view class="label">店铺名称:</view>
- <view class="inp flexS" style="font-size:32rpx;">{{ info.name | getName(10) }}的店铺</view>
- </view>
- <view class="flexB">
- <view class="label">商户电话:</view>
- <view class="flexB inp"><input type="text" disabled v-model="info.phone" /></view>
- </view>
- <view class="flexB">
- <view class="label">店铺地址:</view>
- <view class="flexB inp">
- <textarea disabled v-model="location" auto-height />
- <view>
- <text @click="edit(3)">{{ location ? '修改' : '添加' }}</text>
- <text class="iconfont iconiconfontjiantou2"></text>
- </view>
- </view>
- </view>
- <w-picker ref="Selector" mode="region" themeColor="#F76454" @confirm="onConfirm" />
- <view class="flexB">
- <view class="label">详细地址:</view>
- <view class="flexB inp"><input type="text" disabled v-model="adsParams.address" /></view>
- </view>
- <view class="flexT">
- <view class="label">微信二维码:</view>
- <view>
- <image :src="imgUrl" class="wx_img" @click="uploadCode"></image>
- <view v-if="info.qr_code" class="code_hint">点击二维码可重新上传</view>
- </view>
- </view>
- </view>
- </view>
-
- <view class="edit_name" v-if="statusShow == 1">
- <view class="name">
- <view class="hint">名称建议在10字以内,超出在店铺页可能展示不全*</view>
- <input type="text" placeholder="在此修改店铺名称" placeholder-style="font-size:28rpx;color:#999;" v-model="name"
- maxlength="10" />
- <view class="notice">
- <view>好的店铺名称具备以下特点:</view>
- <view>1.简单易懂,朗朗上口,避免雷同,避免生僻字,尽量体现主营商品。</view>
- <view>2.凸显店铺特色,体现店长风格。</view>
- <view>3.不适用国家法律法规禁止的违规词、敏感词不出现。</view>
- <view>4.不出现“淘宝”“微信”“代理”等会屏蔽的词汇。</view>
- <view>5.建议12字以内,超出在店铺页面可能展示不全。</view>
- </view>
- <view class="sub_btn" @click="finish">完成</view>
- </view>
- </view>
-
- <view class="flexCC edit_phone" v-if="statusShow == 2">
- <view class="old" v-if="step == 0">
- <view class="hint">为保证账号安全,须短信验证{{ phone }}</view>
- <view class="inp flexB">
- <input type="text" placeholder="请输入验证码" maxlength="6" placeholder-style="font-size:28rpx;color:#999"
- v-model="oldSms" />
- <text @click="getOld">{{ oldDown ? `重新获取(${oldDown}s)` : '获取验证码' }}</text>
- </view>
- <view class="sub_btn" @click="next">下一步</view>
- </view>
- <view class="new" v-else>
- <input type="text" placeholder="请输入手机号" maxlength="11" placeholderk-style="font-size:28rpx;color:#999"
- class="phone_inp" v-model="newPhone" :disabled="isEdit" />
- <view class="inp flexB">
- <input type="text" placeholder="请输入验证码" maxlength="6" placeholder-style="font-size:28rpx;color:#999"
- v-model="newSms" />
- <text @click="getNew">{{ newDown ? `重新获取(${newDown}s)` : '获取验证码' }}</text>
- </view>
- <view class="sub_btn" @click="editPhone">完成</view>
- </view>
- </view>
-
- <view class="edit_ads" v-if="statusShow == 3">
- <view>
- <view class="label">
- <text>店铺地址</text>
- <text>*</text>
- </view>
- <picker mode="region" @change="bindRegionChange" :value="location" :custom-item="customItem">
- <view class="flexB picker">
- <text style="font-size:32rpx;padding-left:15rpx;">{{location?location:'请点击选择店铺地址'}}</text>
- <text class="iconfont iconzhcc_xiangxiajiantou"></text>
- </view>
- </picker>
- </view>
- <w-picker ref="Selector" mode="region" themeColor="#F76454" @confirm="onConfirm" />
- <view>
- <view class="label">
- <text>店铺详细地址</text>
- <text>*</text>
- </view>
- <view><input type="text" placeholder="请输入详细地址" v-model="adsParams.address"
- placeholder-style="color:#999;" /></view>
- </view>
- <view @click="editAds" class="sub_btn">{{ location ? '确认修改' : '确认添加' }}</view>
- </view>
- </view>
- </template>
- <script>
- import {
- getStoreInfo,
- sendSms,
- checkPhone,
- editPhone,
- editName,
- editAds
- } from '@/apis/shop.js';
- export default {
- data() {
- return {
- info: '',
- statusShow: 0,
- step: 0,
- name: '',
- store_id: '',
- phone: '',
- oldPhone: '',
- oldSms: '',
- oldDown: 0,
- newPhone: '',
- newSms: '',
- newDown: 0,
- isSend: true,
- timer: null,
- isEdit: false,
- location: '',
- adsParams: {
- province: '',
- city: '',
- area: '',
- address: ''
- },
- imgUrl: '/static/imgs/shop/upload_wx.png'
- };
- },
- onLoad() {
- this.getInfo();
- },
- methods: {
-
- bindRegionChange(e) {
- let ads = e.detail.value;
- this.location = `${ads[0]}-${ads[1]}-${ads[2]}`;
- this.adsParams.province = ads[0];
- this.adsParams.city = ads[1];
- this.adsParams.area = ads[2];
- },
- uploadCode() {
- uni.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album'],
- success: res => {
-
-
-
-
-
-
-
-
-
- uni.showLoading({
- title: '上传中...'
- });
- uni.uploadFile({
- url: `${this.$config.redirect_uri}/api/store_goods/upload_wx_qr_code_img`,
- filePath: res.tempFilePaths[0],
- name: 'img',
- header: {
- Authorization: 'Bearer ' + uni.getStorageSync('token')
-
-
-
- },
- success: upload => {
- let data = JSON.parse(upload.data);
- uni.hideLoading();
- if (data.code == 200) {
- this.imgUrl = data.data;
- uni.showToast({
- title: '修改成功'
- });
- } else {
- uni.showModal({
- content: data.data || '上传二维码失败,请重试',
- showCancel: false
- });
- }
- },
- fail: err => {
- console.log(33333)
- uni.hideLoading();
- uni.showModal({
- content: '上传二维码失败,请重试',
- showCancel: false
- });
- }
- });
- }
- });
- },
-
- getOld() {
- let that = this;
- if (that.oldDown) {
- uni.showModal({
- content: '验证码已发送,请稍后重试',
- showCancel: false
- });
- return false;
- }
- if (!that.oldPhone || that.oldPhone.length != 11) {
- uni.showModal({
- content: '手机号格式不正确',
- showCancel: false
- });
- return false;
- }
- sendSms({
- phone: that.oldPhone,
- type: 'phone'
- }).then(res => {
- if (res.code == 200) {
- uni.showModal({
- content: '验证码发送成功',
- showCancel: false
- });
- this.oldDown = 60;
- this.timer = setInterval(() => {
- this.oldDown--;
- if (!this.oldDown) {
- this.oldDown = 0;
- clearInterval(this.timer);
- }
- }, 1000);
- } else {
- uni.showModal({
- content: res.data || '获取验证码失败',
- showCancel: false
- });
- return false;
- }
- });
- },
-
- getNew() {
- let that = this;
- if (that.newDown) {
- uni.showModal({
- content: '验证码已发送,请稍后重试',
- showCancel: false
- });
- return false;
- }
- if (!that.newPhone || that.newPhone.length != 11) {
- uni.showModal({
- content: '手机号格式不正确',
- showCancel: false
- });
- return false;
- }
- sendSms({
- phone: that.newPhone,
- type: 'phone'
- })
- .then(res => {
- if (res.code == 200) {
- this.isEdit = true;
- uni.showModal({
- content: '验证码发送成功',
- showCancel: false
- });
- this.newDown = 60;
- this.timer = setInterval(() => {
- this.newDown--;
- if (!this.newDown) {
- this.newDown = 0;
- clearInterval(this.timer);
- }
- }, 1000);
- } else {
- uni.showModal({
- content: res.data || '获取验证码失败',
- showCancel: false
- });
- return false;
- }
- })
- .finally(() => {
- this.isEdit = false;
- });
- },
-
- editPhone() {
- let that = this;
- if (!that.newPhone || that.newPhone.length != 11) {
- uni.showModal({
- content: '手机号格式不正确'
- });
- return false;
- }
- if (!that.newSms || that.newSms.length != 6) {
- uni.showModal({
- content: '验证码格式不正确'
- });
- return false;
- }
- if (!that.isSend) return false;
- that.isSend = false;
- editPhone({
- phone: this.newPhone,
- phone_code: this.newSms,
- store_id: this.store_id
- })
- .then(res => {
- if (res.code == 200) {
- uni.showToast({
- title: '修改成功'
- });
- this.statusShow = 0;
- this.getInfo();
- } else {
- uni.showModal({
- content: res.data || '修改手机号失败',
- showCancel: false
- });
- if (res.data == '新手机号不能与旧手机号相同') {
- this.newDown = 0;
- this.newSms = '';
- this.isEdit = false;
- clearInterval(this.timer);
- }
- }
- })
- .catch(e => {})
- .finally(() => {
- that.isSend = true;
- this.isEdit = false;
- });
- },
-
- editAds() {
- if (!this.location) {
- uni.showModal({
- content: '请选择店铺地址',
- showCancel: false
- });
- return false;
- }
- if (!this.adsParams.address) {
- uni.showModal({
- content: '请填写店铺详细地址',
- showCancel: false
- });
- return false;
- }
- let params = this.adsParams;
- editAds(params).then(res => {
- if (res.code == 200) {
- this.statusShow = 0;
- this.getInfo();
- uni.showToast({
- title: '修改成功'
- });
- } else {
- uni.showModal({
- content: res.msg || '修改店铺地址失败',
- showCancel: false
- });
- }
- });
- },
-
- next() {
- let that = this;
- if (!that.oldSms || that.oldSms.length != 6) {
- uni.showModal({
- content: '验证码格式不正确',
- showCancel: false
- });
- return false;
- }
- if (!that.isSend) return false;
- that.isSend = false;
- checkPhone({
- phone: that.oldPhone,
- phone_code: that.oldSms
- })
- .then(res => {
- if (res.code == 200) {
- that.step = 1;
- uni.setNavigationBarTitle({
- title: '绑定新手机号'
- });
- } else {
- uni.showModal({
- content: res.data,
- showCancel: false
- });
- }
- })
- .catch(e => {})
- .finally(() => {
- that.isSend = true;
- });
- },
-
- finish() {
- if (!this.name) {
- uni.showModal({
- content: '店铺名称不能为空',
- showCancel: false
- });
- return false;
- }
- editName({
- name: this.name,
- store_id: this.info.id
- }).then(res => {
- if (res.code == 200) {
- uni.showToast({
- title: '修改成功!',
- duration: 3000
- });
- this.statusShow = 0;
- this.getInfo();
- } else {
- uni.showModal({
- content: res.data || '修改失败',
- showCancel: false
- });
- }
- });
- },
-
- getInfo() {
- uni.showLoading({
- title: '加载中...'
- });
- getStoreInfo()
- .then(res => {
- if (res.code == 200) {
- this.info = res.data.store;
- const {
- province,
- city,
- area,
- address,
- qr_code
- } = res.data.store;
- this.imgUrl = qr_code;
- this.adsParams.province = province;
- this.adsParams.city = city;
- this.adsParams.area = area;
- this.adsParams.address = address ? address : '';
- if (province && city && area) {
- this.location = `${province}-${city}-${area}`;
- }
- this.phone = this.info.phone.substr(0, 3) + '****' + this.info.phone.substr(7);
- this.oldPhone = this.info.phone;
- this.$forceUpdate();
- } else {
- uni.showModal({
- content: res.data || '获取店铺信息失败',
- showCancel: false
- });
- }
- uni.hideLoading();
- })
- .catch(err => {
- uni.hideLoading();
- });
- },
-
- edit(type) {
- this.statusShow = type;
- this.name = this.info.name;
- },
- skipAuth(type) {
- let url = '';
- url = type == 0 ? '../real-name-auth/real-name-auth' : '../auth-center/auth-center';
- uni.navigateTo({
- url
- });
- }
- }
- };
- </script>
- <style lang="scss">
- .shop_info {
- width: 100%;
- min-height: 100%;
- background-color: #fff;
- }
- .edit_name {
- .name {
- .hint {
- font-size: 28rpx;
- color: $base-color;
- margin-left: 16rpx;
- padding: 30rpx 0 20rpx;
- }
- input {
- width: 100%;
- background: #f9f9fb;
- height: 98rpx;
- padding-left: 20rpx;
- }
- .notice {
- width: 690rpx;
- margin: 0 auto 162rpx;
- view {
- padding-top: 5rpx;
- }
- view:first-child {
- font-size: 32rpx;
- font-weight: bold;
- padding: 40rpx 0 20rpx;
- }
- }
- }
- }
- .edit_phone {
- .phone_inp,
- .inp {
- width: 580rpx;
- height: 88rpx;
- background: #f8f8f8;
- padding: 0 30rpx;
- border-radius: 44rpx;
- box-sizing: border-box;
- }
- .inp {
- margin-bottom: 78rpx;
- input {
- width: 60%;
- height: 90%;
- }
- }
- .phone_inp {
- margin: 94rpx 0 30rpx;
- }
- .old {
- .hint {
- margin: 94rpx 0 30rpx;
- }
- }
- }
- .edit_ads {
- width: 690rpx;
- margin: 30rpx auto 0;
- .sub_btn {
- margin-top: 50rpx;
- }
- .label {
- font-size: 32rpx;
- padding: 10rpx 0;
- color: #333;
- font-weight: 600;
- text:last-child {
- color: #f00;
- margin-left: 4rpx;
- font-size: 45rpx;
- }
- }
- input,
- .picker {
- height: 96rpx;
- line-height: 96rpx;
- background: #f8f8f8;
- border-radius: 8rpx;
- }
- .picker {
- padding-right: 30rpx;
- input {
- width: 90%;
- }
- }
- input {
- font-size: 32rpx;
- padding-left: 30rpx;
- }
- }
- .title {
- color: #999;
- font-size: 28rpx;
- padding: 30rpx 0;
- }
- .iconfont {
- font-size: 40rpx;
- color: #999;
- }
- .label {
- font-size: 28rpx;
- }
- .auth,
- .base_info {
- padding: 0 30rpx;
- box-sizing: border-box;
- }
- .base_info {
- .info {
- .wx_img {
- width: 300rpx;
- height: 300rpx;
- }
- >view {
- margin-bottom: 30rpx;
- .inp {
- width: 75%;
- min-height: 72rpx;
- background: #f8f8f8;
- border-radius: 8rpx;
- padding: 0 15rpx;
- box-sizing: border-box;
- }
- input,
- textarea {
- width: 75%;
- font-size: 32rpx;
- }
- .iconfont {
- font-size: 35rpx;
- color: #999;
- }
- }
- image {
- width: 68rpx;
- height: 68rpx;
- border-radius: 8rpx;
- margin-right: 20rpx;
- }
- .code_hint {
- color: $base-color;
- font-size: 28rpx;
- margin-top: 30rpx;
- }
- }
- .upload {
- .up_title {
- font-size: 36rpx;
- font-weight: bold;
- }
- .wx_icon {
- width: 250rpx;
- height: 250rpx;
- margin: 40rpx 0;
- }
- }
- }
- .block {
- width: 100%;
- height: 20rpx;
- background: #f9f9fb;
- }
- .auth {
- .auth_con {
- >view {
- margin-top: 30rpx;
- }
- .iconrenzheng {
- color: $base-color;
- font-size: 45rpx;
- vertical-align: middle;
- margin-right: 5rpx;
- }
- .iconiconfontjiantou2 {
- font-size: 35rpx;
- vertical-align: -2rpx;
- }
- }
- }
- </style>
|