app-close.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <view>
  3. <u-mask v-if="modal" :show="mallStatus.is_open == 2" zIndex="3000" :maskClickAble="false" :zoom="false">
  4. <view style="height: 100%;width: 100%" class="main-center cross-center">
  5. <view class="open-dialog">
  6. <view class="open-dialog-title">商家已打烊</view>
  7. <view class="open-dialog-content">
  8. <view v-if="list.length > 0 && list != '商城'">{{list}}已经打烊</view>
  9. <view v-if="!list">您访问的商家已经打烊</view>
  10. <view v-if="mallStatus.auto_open_text.length > 0">{{mallStatus.auto_open_text}}</view>
  11. </view>
  12. <view @click="toIndex" class="dialog-button" :class="getTheme + '-m-text ' + getTheme">继续浏览</view>
  13. </view>
  14. </view>
  15. </u-mask>
  16. <view v-else>
  17. <view class="dir-left-nowrap cross-center close-tip" v-if="mallStatus.is_open == 2">
  18. <image src="/static/image/icon/be-close.png"></image>
  19. <view class="dir-top-nowrap main-center">
  20. <view>商家已打烊</view>
  21. <view class="close-content" v-if="mallStatus.auto_open_text.length > 0">{{mallStatus.auto_open_text}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {mapState, mapGetters} from 'vuex';
  29. import uMask from "../u-mask/u-mask.vue";
  30. export default {
  31. name: "app-close",
  32. components:{
  33. uMask
  34. },
  35. props: {
  36. modal: {
  37. type: Boolean,
  38. default() {
  39. return true;
  40. }
  41. },
  42. toBack: {
  43. type: Boolean,
  44. default() {
  45. return false;
  46. }
  47. },
  48. mch_id: {
  49. type: Number,
  50. default() {
  51. return 0;
  52. }
  53. },
  54. mch_list: {
  55. type: String,
  56. default() {
  57. return ''
  58. }
  59. }
  60. },
  61. data() {
  62. return {
  63. mallStatus: {
  64. is_open: 0,
  65. auto_open_text: ''
  66. },
  67. isMall: true,
  68. list: ''
  69. }
  70. },
  71. created() {
  72. let para = {};
  73. if(this.mch_list) {
  74. this.mch_list = JSON.parse(this.mch_list);
  75. if(this.mch_list.length > 0) {
  76. para.mch_id_list = this.mch_list;
  77. if(this.mch_list.indexOf(0) == -1) {
  78. this.isMall = false;
  79. }
  80. }
  81. }
  82. if(this.mch_id > 0) {
  83. para.mch_id_list = JSON.stringify([this.mch_id]);
  84. this.isMall = false;
  85. }
  86. this.$request({
  87. url: this.$api.index.status,
  88. data: para
  89. }).then(response => {
  90. let mallStatus = response.data;
  91. if(!this.isMall) {
  92. response.data.shift();
  93. }
  94. this.mallStatus = response.data[0]
  95. if(this.mch_id > 0) {
  96. for(let item of response.data) {
  97. if(item.mch_id == this.mch_id) {
  98. this.mallStatus = item
  99. }
  100. }
  101. }
  102. if(this.mch_list.length > 0) {
  103. this.list = '';
  104. for(let item of response.data) {
  105. if(item.is_open == 2) {
  106. if(!this.mallStatus.auto_open_text) {
  107. this.mallStatus.auto_open_text = item.auto_open_text;
  108. }
  109. this.mallStatus.is_open = item.is_open;
  110. if(this.list.length > 0) {
  111. this.list += '、'
  112. }
  113. this.list += item.name
  114. }
  115. }
  116. this.$emit('update', this.mallStatus)
  117. }else {
  118. this.$emit('update', this.mallStatus)
  119. }
  120. })
  121. },
  122. computed: {
  123. ...mapGetters('mallConfig', {
  124. getTheme: 'getTheme',
  125. }),
  126. ...mapState({
  127. mall: state => state.mallConfig.mall,
  128. userInfo: state => state.user.info,
  129. })
  130. },
  131. methods: {
  132. toIndex() {
  133. if(this.toBack) {
  134. uni.navigateBack();
  135. }else {
  136. uni.redirectTo({
  137. url: '/pages/index/index'
  138. })
  139. }
  140. },
  141. }
  142. }
  143. </script>
  144. <style scoped lang="scss">
  145. .close-tip {
  146. position: fixed;
  147. bottom: 0;
  148. left: 0;
  149. height: 130rpx;
  150. width: 100%;
  151. z-index: 20;
  152. font-size: 30rpx;
  153. color: #353535;
  154. background-color: #fff7d7;
  155. image {
  156. width: 70rpx;
  157. height: 70rpx;
  158. margin: 0 24rpx;
  159. }
  160. .close-content {
  161. padding-top: 10rpx;
  162. font-size: 24rpx;
  163. color: #999999;
  164. }
  165. }
  166. .open-dialog {
  167. width: 620rpx;
  168. border-radius: 16rpx;
  169. background-color: #fff;
  170. position: relative;
  171. padding-top: 40rpx;
  172. padding-bottom: 105rpx;
  173. font-size: 32rpx;
  174. color: #353535;
  175. text-align: center;
  176. .open-dialog-content {
  177. padding: 25rpx 0;
  178. font-size: 26rpx;
  179. color: #666666;
  180. view {
  181. margin: 5rpx 0;
  182. }
  183. }
  184. .dialog-button {
  185. font-size: 30rpx;
  186. position: absolute;
  187. bottom: 0;
  188. left: 0;
  189. border-top: 2rpx solid #e2e2e2;
  190. height: 90rpx;
  191. line-height: 90rpx;
  192. width: 100%;
  193. }
  194. }
  195. </style>