| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365 |
- <template>
- <!-- 店铺管理 -->
- <div class="user-content">
- <template v-if="storeInfo.storeName">
- <div class="topinfo clearfix">
- <div class="pull-left">
- 店铺信息
- </div>
- <div class="pull-right" @click="updateInfo()" v-show="storeState === 'look'">
- <img src="/images/vendor/updateinfo.png"/>
- 编辑
- </div>
- </div>
- <ul class="infoul">
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">店铺名称:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.storeName || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.storeName" type="text"/>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">简介:</div>
- <div class="text pull-left clearfix" v-if="storeState === 'look'">
- {{Islook ? dealWithText(storeInfo.description) : dealWithText()}}
- <a class="pull-right" @click="dealWithText2('open')" v-show="Islook">
- 全部<img src="/images/store/default/openblack.png"/>
- </a>
- <a class="pull-right upload" @click="dealWithText2('hide')" v-show="!hidelook">
- 收起<img src="/images/store/default/openblack.png"/>
- </a>
- </div>
- <div class="text pull-left" v-else>
- <textarea v-model="storeInfo.description">
- </textarea>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">企业地址:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.enterprise.address || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.enterprise.address" type="text"/>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">电话:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.enterprise.enTel || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.enterprise.enTel" type="text"/>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">传真:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.enterprise.enFax || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.enterprise.enFax" type="text"/>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">手机:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.enterprise.enPhone || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.enterprise.enPhone" type="text"/>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">微信:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.enterprise.enWeixin || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.enterprise.enWeixin" type="text"/>
- </div>
- </li>
- <li class="clearfix" :class="{border: storeState !== 'look'}">
- <div class="name pull-left" :class="{update: storeState !== 'look'}">QQ:</div>
- <div class="text pull-left" v-if="storeState === 'look'">
- {{storeInfo.enterprise.enQQ || '暂无信息'}}
- </div>
- <div v-else class="text pull-left">
- <input v-model="storeInfo.enterprise.enQQ" type="text"/>
- </div>
- </li>
- </ul>
- <div class="control clearfix" v-if="storeState !== 'look'">
- <div class="cancel" @click="storeInfosave('cancel')" >取消</div>
- <div class="save" @click="storeInfosave()">保存</div>
- </div>
- </template>
- <template v-else>
- <div class="none-state">
- <img src="/images/mobile/@2x/empty-collect.png">
- <p v-text="getRemindText"></p>
- <nuxt-link to="/">返回首页</nuxt-link>
- </div>
- </template>
- <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
- <div v-if="storeI && false"></div>
- </div>
- <!-- /end 店铺管理 -->
- </template>
- <script>
- import { RemindBox } from '~components/mobile/common'
- export default {
- layout: 'mobile',
- middleware: 'authenticated',
- fetch ({ store, route }) {
- return Promise.all([
- store.dispatch('loadStoreStatus', { op: 'check' })
- ])
- },
- data() {
- return {
- storeState: 'look',
- storeInfo: {},
- splitText: '', // 省略号文本
- normalText: '', // 原来文本
- Islook: true,
- hidelook: true,
- timeoutCount: 0,
- collectResult: ''
- }
- },
- methods: {
- updateInfo() {
- this.storeState = 'update'
- this.Islook = true
- this.hidelook = true
- },
- dealWithText2(tp) {
- if (tp === 'open') {
- this.Islook = false
- this.hidelook = false
- } else {
- this.Islook = true
- this.hidelook = true
- }
- },
- dealWithText(_T) {
- if (_T !== undefined) {
- // 文本处理
- this.normalText = _T
- if (_T.length < 140) {
- this.Islook = false
- return _T
- } else {
- this.Islook = true
- return _T.substr(0, 140) + '...'
- }
- } else {
- this.Islook = false
- return this.normalText
- }
- },
- storeInfosave(_tp) {
- if (_tp === 'cancel') {
- let str = JSON.stringify(this.$store.state.option.storeStatus.data)
- this.storeInfo = JSON.parse(str)
- this.storeState = 'look'
- return false
- }
- if (!this.storeInfo) {
- this.collectResult = '店铺信息不能为空'
- this.timeoutCount++
- return false
- }
- if (!this.storeInfo.description || this.storeInfo.description === '') {
- this.collectResult = '店铺简介信息不能为空'
- this.timeoutCount++
- return false
- }
- if (!this.storeInfo.enterprise) {
- this.collectResult = '企业信息不能为空'
- this.timeoutCount++
- return false
- }
- if (!this.storeInfo.enterprise.address || this.storeInfo.enterprise.address === '') {
- this.collectResult = '企业地址不能为空'
- this.timeoutCount++
- return false
- }
- if (!this.storeInfo.enterprise.enTel || this.storeInfo.enterprise.enTel === '') {
- this.collectResult = '请输入正确的电话号码'
- this.timeoutCount++
- return false
- }
- if (!/^1[3|4|5|6|7|8|9][0-9]{9}$/.test(this.storeInfo.enterprise.enPhone) && this.storeInfo.enterprise.enPhone) {
- this.collectResult = '请输入正确的手机号码'
- this.timeoutCount++
- return false
- }
- if (!/^[a-zA-Z]{1}[-_a-zA-Z0-9]{5,19}$/.test(this.storeInfo.enterprise.enWeixin) && this.storeInfo.enterprise.enWeixin) {
- this.collectResult = '请输入正确的微信号'
- this.timeoutCount++
- return false
- }
- if (!/^[1-9][0-9]{4,10}$/.test(this.storeInfo.enterprise.enQQ) && this.storeInfo.enterprise.enQQ) {
- this.collectResult = '请输入正确的QQ号'
- this.timeoutCount++
- return false
- }
- let kay = {
- description: this.storeInfo.description,
- enterprise: this.storeInfo.enterprise,
- storeName: this.storeInfo.storeName,
- storeShortName: this.storeInfo.storeShortName
- }
- this.$http.put(`/store-service/stores/${this.storeInfo.uuid}?kind=BASIC_INFO`, kay).then(res => {
- this.collectResult = '保存成功'
- this.timeoutCount++
- this.storeState = 'look'
- }).catch(err => {
- this.collectResult = err.response.data
- this.timeoutCount++
- let str = JSON.stringify(this.$store.state.option.storeStatus.data)
- this.storeInfo = JSON.parse(str)
- })
- }
- },
- computed: {
- getRemindText: function () {
- return '您的账户暂未开通店铺,请前往pc端申请开通!'
- },
- storeI() {
- let str = JSON.stringify(this.$store.state.option.storeStatus.data)
- this.storeInfo = JSON.parse(str)
- return ''
- }
- },
- components: {
- RemindBox
- }
- }
- </script>
- <style lang="scss" scoped>
- .user-content {
- margin-top: 1.4rem;
- padding-bottom: 0.98rem;
- }
- .topinfo {
- padding: 0 0.24rem;
- color: #333;
- font-size: 0.28rem;
- height: 0.8rem;
- line-height: 0.8rem;
- border-bottom: 0.01rem solid #d9d9d9;
- .pull-right {
- color: #999;
- font-size: 0.26rem;
- img {
- width: 0.34rem;
- height: 0.34rem;
- }
- }
- }
- .infoul {
- .upload {
- img {
- transform: rotate(180deg);
- }
- }
- color: #666;
- font-size: 0.28rem;
- li {
- padding: 0.15rem 0.05rem;
- line-height: 1.3;
- &.border {
- border-bottom: 0.01rem solid #d9d9d9;
- }
- &.noupdate {
- background: #fafafa;
- color: #999;
- }
- }
- .name {
- width: 1.6rem;
- text-align: right;
- }
- .text {
- width: 5.4rem;
- }
- .update {
- padding: 0.06rem 0 0.06rem 0rem;
- }
- input {
- width: 5.4rem;
- border: 0px solid #b4b4b4;
- padding: 0.06rem 0 0.06rem 0.12rem;
- }
- textarea{
- width: 5.4rem;
- padding: 0.06rem 0 0.06rem 0.12rem;
- min-height: 5rem;
- resize: none;
- border: 0px solid #b4b4b4;
- }
- }
- .control {
- width: 90%;
- margin: 0.15rem auto 0.4rem;
- height: .88rem;
- line-height: 0.88rem;
- }
- .save {
- border-radius: 3px;
- width: 48%;
- color: #fff;
- text-align: center;
- height: .88rem;
- line-height: 0.88rem;
- background: #3e82f5;
- float: right;
- }
- .cancel {
- border-radius: 3px;
- width: 48%;
- background: #acabab;
- color: #fff;
- text-align: center;
- height: .88rem;
- line-height: 0.88rem;
- float: left;
- }
- .none-state{
- text-align: center;
- padding:1.5rem 0;
- background: #fff;
- margin-top:.1rem;
- width:100%;
- img{
- margin:0 auto;
- width: 4.08rem;
- height: 2.62rem;
- }
- p {
- font-size: .32rem;
- color: #999;
- margin: 1.19rem 0 0 0;
- }
- a {
- display: block;
- font-size: .28rem;
- color: #fff;
- width: 1.88rem;
- height: .54rem;
- line-height: .54rem;
- background: #418bf6;
- margin: .7rem auto 0;
- border-radius: .05rem;
- }
- }
- </style>
|