manage.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view class="page">
  3. <view class="btg" v-if="item.auditFlag == 0" style="margin: 0px 0px 12px 0px;background-color: #f0f9eb;color: #67c23a;">后台审核中..... 审核通过后才能展示出来</view>
  4. <view class="btg" v-if="item.orders" style="margin: 0px 0px 12px 0px;background-color: #f0f9eb;color: #67c23a;" @click="navigate('/pages/order/sale')">
  5. <text>你有{{ item.orders }}条待处理订单,请尽快处理</text>
  6. <text class="icon">&#xe62d;</text>
  7. </view>
  8. <view class="btg" v-if="item.auditFlag == 2" style="margin: 0px 0px 12px 0px;" @click="navigate('/pages/shop/apply?item=' + JSON.stringify(item))">
  9. <text>审核不通过: {{ item.msg }}</text>
  10. <text class="icon">&#xe62d;</text>
  11. </view>
  12. <view class="hotel_item">
  13. <u-grid :col="3" class="cd">
  14. <u-grid-item @click="navigate('/pages/shop/apply?item=' + JSON.stringify(item))">
  15. <u-badge :is-dot="true" :offset="[25, 40]" v-if="item.auditFlag == 2"></u-badge>
  16. <view class="icon" style="background-color: #F44336">&#xe610;</view>
  17. <view class="grid-text">店铺信息</view>
  18. </u-grid-item>
  19. <u-grid-item @click="navigate('/pages/shop/detail?shopId=' + item.shopId)">
  20. <view class="icon" style="background-color: #67c23a">&#xec86;</view>
  21. <view class="grid-text">店铺预览</view>
  22. </u-grid-item>
  23. <u-grid-item @click="navigate('/pages/shop/up?item=' + JSON.stringify(item))">
  24. <view class="icon" style="background-color: #607D8B">&#xebb3;</view>
  25. <view class="grid-text">上报数据</view>
  26. </u-grid-item>
  27. </u-grid>
  28. <view v-if="item.shopType == 2">
  29. <view style="margin: 20px 0px 20px 0px;"><u-divider>酒店预订</u-divider></view>
  30. <u-grid :col="3" class="cd">
  31. <u-grid-item @click="navigate('/pages/shop/hotel/room?shopId=' + item.shopId)">
  32. <view class="icon" style="background-color: #FF9800">&#xe736;</view>
  33. <view class="grid-text">房间管理</view>
  34. </u-grid-item>
  35. <u-grid-item @click="navigate('/pages/order/sale')">
  36. <u-badge :count="item.orders" :offset="[20, 30]" v-if="item.auditFlag == 1"></u-badge>
  37. <view class="icon" style="background-color: #9E9E9E">&#xe705;</view>
  38. <view class="grid-text">预订订单</view>
  39. </u-grid-item>
  40. </u-grid>
  41. </view>
  42. </view>
  43. <view class="hotel_item" v-if="item.shopType == 2">
  44. <view class="enable">
  45. <text>是否开启酒店预订</text>
  46. <u-switch v-model="item.enableFlag" @change="change" active-color="#67c23a" active-value="0" inactive-value="1"></u-switch>
  47. </view>
  48. </view>
  49. <view class="hotel_item">
  50. <view class="enable">
  51. <text>注销并且关闭店铺</text>
  52. <text class="del" @click="del()">确定</text>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. ip: this.$http.urls.ip,
  62. item: {},
  63. shopId: '' //店铺id
  64. };
  65. },
  66. onLoad(e) {
  67. this.shopId = e.shopId;
  68. },
  69. onShow() {
  70. this.getData();
  71. },
  72. methods: {
  73. //获取数据
  74. getData() {
  75. this.$http.request({
  76. url: this.$http.urls.shopManage,
  77. data: { shopId: this.shopId },
  78. success: res => {
  79. this.item = res.data.data.shop;
  80. this.item.enableFlag = this.item.enableFlag == 0 ? true : false;
  81. //待处理订单
  82. if (res.data.data.orders) {
  83. this.item.orders = res.data.data.orders.length;
  84. }
  85. this.item.imgs = []; //轮播图
  86. this.item.showPictures = this.item.showPictures.split(',');
  87. this.item.pic = this.item.pic.split(',');
  88. this.item.showPictures.forEach(item => {
  89. this.item.imgs.push({ image: this.ip + item });
  90. });
  91. }
  92. });
  93. },
  94. navigate(url) {
  95. if (url.indexOf('/apply') == -1 && this.item.auditFlag != 1) {
  96. uni.showModal({ content: '审核通过后才能操作', showCancel: false });
  97. return;
  98. }
  99. uni.navigateTo({ url: url });
  100. },
  101. // 是否开启酒店预订
  102. change(status) {
  103. this.$http.request({
  104. url: this.$http.urls.hotelEnable,
  105. data: { shopId: this.item.shopId, enableFlag: status },
  106. success: res => {}
  107. });
  108. },
  109. //注销并且关闭店铺
  110. del() {
  111. uni.showModal({
  112. title: '提示',
  113. content: '是否注销并且关闭店铺?',
  114. success: res => {
  115. if (res.confirm) {
  116. this.$http.request({
  117. url: this.$http.urls.hotelDelete,
  118. data: { shopId: this.item.shopId },
  119. success: res => {
  120. uni.$emit('shop');
  121. uni.showToast({ title: '操作成功' });
  122. setTimeout(() => {
  123. uni.navigateBack();
  124. }, 1000);
  125. }
  126. });
  127. }
  128. }
  129. });
  130. }
  131. },
  132. //下拉刷新
  133. onPullDownRefresh() {
  134. setTimeout(() => {
  135. uni.stopPullDownRefresh();
  136. this.getData();
  137. }, 1000);
  138. }
  139. };
  140. </script>
  141. <style lang="scss">
  142. .page {
  143. padding: 12px;
  144. }
  145. .enable {
  146. padding: 10px;
  147. font-size: 16px;
  148. .u-switch {
  149. margin-top: -5px;
  150. float: right;
  151. }
  152. .del {
  153. float: right;
  154. color: red;
  155. }
  156. }
  157. .cd {
  158. margin-top: 10px;
  159. text-align: center;
  160. .icon {
  161. font-size: 30px;
  162. padding: 5px 8px;
  163. background-color: red;
  164. color: white;
  165. margin-bottom: 5px;
  166. border-radius: 5px;
  167. }
  168. }
  169. </style>