index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view>
  3. <view class="store_content" :class="isShow?'on':''">
  4. <view class="popup" :class="{ on: isShow }">
  5. <scroll-view scroll-y="true">
  6. <radio-group name="store_name" @change="changeStore">
  7. <template v-for="item in storeList">
  8. <div v-if="item.merchant" class="store-list">
  9. <!-- <div class="invoice-list"> -->
  10. <label :key="item.merchant.mer_id" class="acea-row row-middle">
  11. <view class="text">
  12. <view class="acea-row row-middle">
  13. <image class="mer_logo" v-if="item.merchant.mer_avatar"
  14. :src="item.merchant.mer_avatar" mode=""></image>
  15. <view class="name line1">{{ item.merchant.mer_name }}</view>
  16. </view>
  17. </view>
  18. <radio class="radio" :value="item.merchant.mer_id.toString()" :checked="item.merchant.mer_id == id ? true : false" />
  19. </label>
  20. <!-- </div> -->
  21. </div>
  22. </template>
  23. </radio-group>
  24. </scroll-view>
  25. </view>
  26. </view>
  27. <view class='mask' catchtouchmove="true" :hidden='!isShow' @tap='close'></view>
  28. </view>
  29. </template>
  30. <script>
  31. // +----------------------------------------------------------------------
  32. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  33. // +----------------------------------------------------------------------
  34. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  35. // +----------------------------------------------------------------------
  36. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  37. // +----------------------------------------------------------------------
  38. // | Author: CRMEB Team <admin@crmeb.com>
  39. // +----------------------------------------------------------------------
  40. import {
  41. getStoreList
  42. } from '@/api/user.js';
  43. export default {
  44. props:['is_sys'],
  45. data() {
  46. return {
  47. isShow: false,
  48. id: '',
  49. storeList: [],
  50. }
  51. },
  52. watch: {
  53. },
  54. mounted(){
  55. },
  56. methods: {
  57. isShowStore(){
  58. this.isShow = !this.isShow;
  59. },
  60. close: function() {
  61. this.$emit('changeStoreClose');
  62. this.isShow = false;
  63. },
  64. changeStore(e) {
  65. this.close()
  66. this.getStoreName(e.detail.value)
  67. uni.setStorageSync('serMerId',e.detail.value)
  68. },
  69. //获取店铺列表
  70. getStoreList(parmas){
  71. getStoreList(parmas).then(res => {
  72. this.storeList = res.data;
  73. let serMerId = this.is_sys !== '' ? null : uni.getStorageSync('serMerId')
  74. let storeInfo = null;
  75. let flag = false
  76. this.storeList.forEach(item=>{
  77. if(flag) return;
  78. if(!serMerId){
  79. if(this.is_sys && !item['merchant']['mer_id']){
  80. storeInfo = item;
  81. flag = true;
  82. }else if(this.is_sys == '0' && item['merchant']['mer_id']){
  83. storeInfo = item;
  84. flag = true;
  85. }
  86. }else if(serMerId == item['merchant']['mer_id']){
  87. storeInfo = item;
  88. flag = true;
  89. }
  90. })
  91. if(!storeInfo){
  92. storeInfo = this.storeList[0]
  93. }
  94. this.id = storeInfo ? storeInfo['mer_id'] : ''
  95. this.$emit('getStoreInfo', storeInfo['merchant'])
  96. this.$emit('getService', storeInfo);
  97. })
  98. },
  99. //根据店铺ID匹配店铺名
  100. getStoreName(id){
  101. for (let i = 0; i < this.storeList.length; i++) {
  102. if (this.storeList[i]['merchant']['mer_id'] == id) {
  103. this.$emit('getStoreInfo',this.storeList[i]['merchant']);
  104. uni.setStorageSync('storeInfo', this.storeList[i]['merchant']);
  105. this.$emit('getService',this.storeList[i]);
  106. }
  107. }
  108. },
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. .store_content{
  114. position: fixed;
  115. bottom: 0;
  116. width: 100%;
  117. left: 0;
  118. background-color: #fff;
  119. z-index: 77;
  120. border-radius: 16rpx 16rpx 0 0;
  121. padding-bottom: 60rpx;
  122. transform: translate3d(0, 100%, 0);
  123. transition: all .3s cubic-bezier(.25, .5, .5, .9);
  124. }
  125. .store_content.on {
  126. transform: translate3d(0, 0, 0);
  127. }
  128. .store_content .title {
  129. font-size: 32rpx;
  130. font-weight: bold;
  131. text-align: center;
  132. height: 123rpx;
  133. line-height: 123rpx;
  134. position: relative;
  135. }
  136. .store_content .title .iconfont {
  137. position: absolute;
  138. right: 30rpx;
  139. color: #8a8a8a;
  140. font-size: 35rpx;
  141. }
  142. .store_content .store-list{
  143. height: 120rpx;
  144. line-height: 120rpx;
  145. }
  146. .store_content .store-list .mer_logo{
  147. width: 60rpx;
  148. height: 60rpx;
  149. margin-right: 20rpx;
  150. }
  151. form {
  152. font-size: 28rpx;
  153. color: #282828;
  154. }
  155. form input,
  156. form radio-group {
  157. flex: 1;
  158. text-align: right;
  159. }
  160. form input {
  161. font-size: 26rpx;
  162. }
  163. form label {
  164. margin-right: 50rpx;
  165. }
  166. form radio {
  167. margin-right: 8rpx;
  168. }
  169. form checkbox-group {
  170. height: 90rpx;
  171. }
  172. form checkbox {
  173. margin-right: 20rpx;
  174. }
  175. form button {
  176. height: 76rpx;
  177. border-radius: 38rpx;
  178. margin: 16rpx 30rpx;
  179. background-color: #E93323;
  180. font-size: 30rpx;
  181. line-height: 76rpx;
  182. color: #FFFFFF;
  183. }
  184. .panel {
  185. padding-right: 30rpx;
  186. padding-left: 30rpx;
  187. background-color: #FFFFFF;
  188. }
  189. .panel~.panel {
  190. margin-top: 14rpx;
  191. }
  192. .panel .acea-row {
  193. height: 90rpx;
  194. }
  195. .panel .acea-row~.acea-row {
  196. border-top: 1px solid #EEEEEE;
  197. }
  198. .input-placeholder {
  199. font-size: 26rpx;
  200. color: #BBBBBB;
  201. }
  202. .icon-xiangyou {
  203. margin-left: 25rpx;
  204. font-size: 18rpx;
  205. color: #BFBFBF;
  206. }
  207. .btn-wrap {
  208. width: 100%;
  209. padding: 8px 16px;
  210. border-top: 1px solid #F5F5F5;
  211. }
  212. .btn-wrap .back {
  213. border: 1px solid #E93323;
  214. background: none;
  215. color: #E93323;
  216. }
  217. .popup {
  218. width: 100%;
  219. border-top-left-radius: 16rpx;
  220. border-top-right-radius: 16rpx;
  221. background-color: #FFFFFF;
  222. overflow: hidden;
  223. }
  224. .popup scroll-view {
  225. height: 466rpx;
  226. padding-right: 30rpx;
  227. padding-left: 30rpx;
  228. box-sizing: border-box;
  229. }
  230. .popup .text {
  231. flex: 1;
  232. min-width: 0;
  233. font-size: 28rpx;
  234. color: #282828;
  235. }
  236. .popup .info {
  237. margin-top: 10rpx;
  238. font-size: 22rpx;
  239. color: #909090;
  240. }
  241. .popup .icon-guanbi {
  242. position: absolute;
  243. top: 50%;
  244. right: 30rpx;
  245. z-index: 2;
  246. transform: translateY(-50%);
  247. font-size: 30rpx;
  248. color: #707070;
  249. cursor: pointer;
  250. }
  251. .popup button {
  252. height: 86rpx;
  253. border-radius: 43rpx;
  254. margin-right: 30rpx;
  255. margin-left: 30rpx;
  256. background-color: #E93323;
  257. font-size: 30rpx;
  258. line-height: 86rpx;
  259. color: #FFFFFF;
  260. }
  261. .popup .text .acea-row {
  262. display: inline-flex;
  263. max-width: 100%;
  264. }
  265. .popup .name {
  266. flex: 1;
  267. overflow: hidden;
  268. white-space: nowrap;
  269. text-overflow: ellipsis;
  270. font-size: 30rpx;
  271. }
  272. .popup .label {
  273. width: 56rpx;
  274. height: 28rpx;
  275. border: 1px solid #E93323;
  276. margin-left: 18rpx;
  277. font-size: 20rpx;
  278. line-height: 26rpx;
  279. text-align: center;
  280. color: #E93323;
  281. }
  282. .popup .type {
  283. width: 124rpx;
  284. height: 42rpx;
  285. margin-top: 14rpx;
  286. background-color: #FCF0E0;
  287. font-size: 24rpx;
  288. line-height: 42rpx;
  289. text-align: center;
  290. color: #D67300;
  291. }
  292. .popup .type.special {
  293. background-color: #FDE9E7;
  294. color: #E93323;
  295. }
  296. </style>