store.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="店铺详情"
  5. :placeholder="true"
  6. :autoBack="true"
  7. @leftClick="leftClick"
  8. :safeAreaInsetTop="true"
  9. >
  10. </u-navbar>
  11. <view class="page-wrap">
  12. <u-swiper
  13. v-if="mainImgList.length>0"
  14. :list="mainImgList"
  15. height="700rpx"
  16. @change="e => currentNum = e.current"
  17. :autoplay="false"
  18. indicatorStyle="right: 20px"
  19. >
  20. <view slot="indicator" class="indicator-num">
  21. <text class="indicator-num__text">{{ currentNum + 1 }}/{{ mainImgList.length }}</text>
  22. </view>
  23. </u-swiper>
  24. </view>
  25. <view class="info">
  26. <view class="title">店铺信息</view>
  27. <view class="info-item">
  28. <view class="left">门店地址:{{details.address}}</view>
  29. </view>
  30. <view class="info-item u-flex u-row-between">
  31. <view class="left">营业时间:{{details.workTime}}</view>
  32. <view class="right update" @click="timeShow = true">更新</view>
  33. </view>
  34. <view class="info-item u-flex u-row-between">
  35. <view class="left">联系电话:{{details.tel}}</view>
  36. <view class="right update" @click="telShow = true">更新</view>
  37. </view>
  38. <view class="info-item u-flex u-row-between">
  39. <view class="left">
  40. 门店推广码:
  41. <text @click="$u.route('/center/paycode',{id:details.id})" style="color: #00A447;">查看</text>
  42. </view>
  43. </view>
  44. <view class="info-item u-flex u-col-top">
  45. <view class="left">营业资质:</view>
  46. <view class="imgs">
  47. <u-album :urls="details.certificationList"></u-album>
  48. </view>
  49. </view>
  50. </view>
  51. <u-modal :show="telShow" title="修改联系电话" @confirm="changeTel" @cancel="telShow=false" :showCancelButton="true" >
  52. <view class="slot-content">
  53. <u--input
  54. placeholder="请输入联系电话"
  55. border="surround"
  56. v-model="tempTel"
  57. >
  58. </u--input>
  59. </view>
  60. </u-modal>
  61. <u-modal :show="timeShow" title="修改营业时间" @confirm="changeTime" @cancel="timeShow=false" :showCancelButton="true" >
  62. <view class="slot-content">
  63. <u--input
  64. placeholder="营业时间如:09:00~18:00"
  65. border="surround"
  66. v-model="tempTime"
  67. >
  68. </u--input>
  69. </view>
  70. </u-modal>
  71. <u-toast ref="uToast"></u-toast>
  72. </view>
  73. </template>
  74. <script>
  75. export default {
  76. data() {
  77. return {
  78. id:'',
  79. details:{slideImgList:[]},
  80. mainImgList:[],
  81. currentNum:0,
  82. telShow:false,
  83. tempTel:'',
  84. timeShow:false,
  85. tempTime:'',
  86. }
  87. },
  88. onShow() {
  89. },
  90. onLoad(page) {
  91. this.id = page.id;
  92. this.getPageData();
  93. },
  94. methods: {
  95. leftClick(){
  96. console.log('leftClick');
  97. },
  98. getPageData(){
  99. this.$u.api.shopById({id:this.id}).then(res=>{
  100. this.details = res.data;
  101. this.mainImgList = res.data.mainImgList||[];
  102. // console.log('getPageData',this.details);
  103. }).catch(err=>{
  104. console.log('getPageData',err);
  105. })
  106. },
  107. shopUpdate(type){
  108. let params ={
  109. id:this.id
  110. };
  111. if(type == 'workTime'){
  112. params.workTime = this.tempTime;
  113. }else if(type == 'tel'){
  114. params.tel = this.tempTel;
  115. }
  116. this.$u.api.shopUpdate(params).then(res=>{
  117. this.getPageData();
  118. }).catch(err=>{
  119. console.log('err',err);
  120. })
  121. },
  122. changeTime(){
  123. let that = this;
  124. this.timeShow = false;
  125. if(this.tempTime.length<1){
  126. this.$refs.uToast.show({
  127. type: 'error',
  128. title: '提示',
  129. message: "请输入营业时间",
  130. complete(){
  131. that.timeShow = true
  132. }
  133. })
  134. }else{
  135. this.shopUpdate('workTime')
  136. }
  137. },
  138. changeTel(){
  139. let that = this;
  140. // let isTel = uni.$u.test.mobile(this.tempTel);
  141. let isEmpty = uni.$u.test.isEmpty(this.tempTel);
  142. this.telShow = false;
  143. if(isEmpty){
  144. this.$refs.uToast.show({
  145. type: 'error',
  146. title: '提示',
  147. message: "请输入联系电话",
  148. complete(){
  149. that.telShow = true
  150. }
  151. })
  152. }else{
  153. this.shopUpdate('tel')
  154. }
  155. }
  156. }
  157. }
  158. </script>
  159. <style>
  160. page{
  161. background-color: #F5F5F5;
  162. }
  163. </style>
  164. <style lang="scss" scoped>
  165. .info{
  166. margin-top: 24rpx;
  167. background-color: #fff;
  168. padding: 28rpx 30rpx 30rpx 0;
  169. .title{
  170. margin-bottom: 20rpx;
  171. font-size: 32rpx;
  172. font-weight: 400;
  173. color: #333333;
  174. line-height: 45rpx;
  175. border-left: 2px solid #00A447;
  176. padding-left: 26rpx;
  177. }
  178. .info-item{
  179. margin-left: 30rpx;
  180. font-size: 30rpx;
  181. font-family: PingFangSC-Regular, PingFang SC;
  182. font-weight: 400;
  183. color: #999999;
  184. line-height: 42rpx;
  185. margin-bottom: 20rpx;
  186. .update{
  187. color: #333;
  188. }
  189. }
  190. }
  191. </style>