store.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  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="details.slideImgList.length>0"
  14. :list="details.slideImgList"
  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 }}/{{ details.slideImgList.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. currentNum:0,
  81. telShow:false,
  82. tempTel:'',
  83. timeShow:false,
  84. tempTime:'',
  85. }
  86. },
  87. onShow() {
  88. },
  89. onLoad(page) {
  90. this.id = page.id;
  91. this.getPageData();
  92. },
  93. methods: {
  94. leftClick(){
  95. console.log('leftClick');
  96. },
  97. getPageData(){
  98. this.$u.api.shopById({id:this.id}).then(res=>{
  99. this.details = res.data;
  100. // console.log('getPageData',this.details);
  101. }).catch(err=>{
  102. console.log('getPageData',err);
  103. })
  104. },
  105. shopUpdate(type){
  106. let params ={
  107. id:this.id
  108. };
  109. if(type == 'workTime'){
  110. params.workTime = this.tempTime;
  111. }else if(type == 'tel'){
  112. params.tel = this.tempTel;
  113. }
  114. this.$u.api.shopUpdate(params).then(res=>{
  115. this.getPageData();
  116. }).catch(err=>{
  117. console.log('err',err);
  118. })
  119. },
  120. changeTime(){
  121. let that = this;
  122. this.timeShow = false;
  123. if(this.tempTime.length<1){
  124. this.$refs.uToast.show({
  125. type: 'error',
  126. title: '提示',
  127. message: "请输入营业时间",
  128. complete(){
  129. that.timeShow = true
  130. }
  131. })
  132. }else{
  133. this.shopUpdate('workTime')
  134. }
  135. },
  136. changeTel(){
  137. let that = this;
  138. // let isTel = uni.$u.test.mobile(this.tempTel);
  139. let isEmpty = uni.$u.test.isEmpty(this.tempTel);
  140. this.telShow = false;
  141. if(isEmpty){
  142. this.$refs.uToast.show({
  143. type: 'error',
  144. title: '提示',
  145. message: "请输入联系电话",
  146. complete(){
  147. that.telShow = true
  148. }
  149. })
  150. }else{
  151. this.shopUpdate('tel')
  152. }
  153. }
  154. }
  155. }
  156. </script>
  157. <style>
  158. page{
  159. background-color: #F5F5F5;
  160. }
  161. </style>
  162. <style lang="scss" scoped>
  163. .info{
  164. margin-top: 24rpx;
  165. background-color: #fff;
  166. padding: 28rpx 30rpx 30rpx 0;
  167. .title{
  168. margin-bottom: 20rpx;
  169. font-size: 32rpx;
  170. font-weight: 400;
  171. color: #333333;
  172. line-height: 45rpx;
  173. border-left: 2px solid #00A447;
  174. padding-left: 26rpx;
  175. }
  176. .info-item{
  177. margin-left: 30rpx;
  178. font-size: 30rpx;
  179. font-family: PingFangSC-Regular, PingFang SC;
  180. font-weight: 400;
  181. color: #999999;
  182. line-height: 42rpx;
  183. margin-bottom: 20rpx;
  184. .update{
  185. color: #333;
  186. }
  187. }
  188. }
  189. </style>