app-close.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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" :style="{'color':getTheme.color}">继续浏览</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, String],
  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. let mch_list = ''
  74. if(this.mch_list) {
  75. mch_list = this.mch_list;
  76. if(mch_list.length > 0) {
  77. para.mch_id_list = mch_list;
  78. if(mch_list.indexOf(0) == -1) {
  79. this.isMall = false;
  80. }
  81. }
  82. }
  83. if(this.mch_id > 0) {
  84. para.mch_id_list = JSON.stringify([this.mch_id]);
  85. this.isMall = false;
  86. }
  87. this.$request({
  88. url: this.$api.index.status,
  89. data: para
  90. }).then(response => {
  91. console.log(para)
  92. let mallStatus = response.data;
  93. if(!this.isMall) {
  94. response.data.shift();
  95. }
  96. this.mallStatus = response.data[0]
  97. if(this.mch_id > 0) {
  98. for(let item of response.data) {
  99. if(item.mch_id == this.mch_id) {
  100. this.mallStatus = item
  101. }
  102. }
  103. }
  104. if(mch_list.length > 0) {
  105. this.list = '';
  106. for(let item of response.data) {
  107. if(item.is_open == 2) {
  108. if(!this.mallStatus.auto_open_text) {
  109. this.mallStatus.auto_open_text = item.auto_open_text;
  110. }
  111. this.mallStatus.is_open = item.is_open;
  112. if(this.list.length > 0) {
  113. this.list += '、'
  114. }
  115. this.list += item.name
  116. }
  117. }
  118. this.$emit('update', this.mallStatus)
  119. }else {
  120. this.$emit('update', this.mallStatus)
  121. }
  122. })
  123. },
  124. computed: {
  125. ...mapGetters('mallConfig', {
  126. getTheme: 'getTheme',
  127. }),
  128. ...mapState({
  129. mall: state => state.mallConfig.mall,
  130. userInfo: state => state.user.info,
  131. })
  132. },
  133. methods: {
  134. toIndex() {
  135. if(this.toBack) {
  136. uni.navigateBack();
  137. }else {
  138. uni.redirectTo({
  139. url: '/pages/index/index'
  140. })
  141. }
  142. },
  143. }
  144. }
  145. </script>
  146. <style scoped lang="scss">
  147. .close-tip {
  148. position: fixed;
  149. bottom: 0;
  150. left: 0;
  151. height: 130rpx;
  152. width: 100%;
  153. z-index: 20;
  154. font-size: 30rpx;
  155. color: #353535;
  156. background-color: #fff7d7;
  157. image {
  158. width: 70rpx;
  159. height: 70rpx;
  160. margin: 0 24rpx;
  161. }
  162. .close-content {
  163. padding-top: 10rpx;
  164. font-size: 24rpx;
  165. color: #999999;
  166. }
  167. }
  168. .open-dialog {
  169. width: 620rpx;
  170. border-radius: 16rpx;
  171. background-color: #fff;
  172. position: relative;
  173. padding-top: 40rpx;
  174. padding-bottom: 105rpx;
  175. font-size: 32rpx;
  176. color: #353535;
  177. text-align: center;
  178. .open-dialog-content {
  179. padding: 25rpx 0;
  180. font-size: 26rpx;
  181. color: #666666;
  182. view {
  183. margin: 5rpx 0;
  184. }
  185. }
  186. .dialog-button {
  187. font-size: 30rpx;
  188. position: absolute;
  189. bottom: 0;
  190. left: 0;
  191. border-top: 2rpx solid #e2e2e2;
  192. height: 90rpx;
  193. line-height: 90rpx;
  194. width: 100%;
  195. }
  196. }
  197. </style>