index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. <template>
  2. <view class="out-box">
  3. <view class="app-view">
  4. <view class="now-name">常用应用</view>
  5. <view class="app-ul">
  6. <block v-for="(app, appi) in now_list" :key="appi">
  7. <view class="app-li" @click="chooseMenu(app)" v-if="$accessCheck($Access[app.access])">
  8. <view class="icon-view" :style="{ background: app.color }"><text :class="[app.icon]" class="custom-icon"></text></view>
  9. <view class="label ellipsis">{{ app.label }}</view>
  10. <view class="icon-circle"><u-icon name="minus-circle-fill" color="#fa3534" size="24"></u-icon></view>
  11. </view>
  12. </block>
  13. </view>
  14. </view>
  15. <view class="app-view" v-for="(item, index) in app_list" :key="index">
  16. <view class="menu-name">{{ item.menuName }}</view>
  17. <view class="app-ul">
  18. <block v-for="(app, appi) in item.menuList" :key="appi">
  19. <view class="app-li" @click="chooseMenu(app)" v-if="$accessCheck($Access[app.access])">
  20. <view class="icon-view" :style="{ background: app.color, opacity: now_list.find(menu => menu.url === app.url) ? '0.6' : '1' }">
  21. <text :class="[app.icon]" class="custom-icon"></text>
  22. </view>
  23. <view class="label ellipsis">{{ app.label }}</view>
  24. <view class="icon-circle">
  25. <u-icon v-if="!!now_list.find(menu => menu.url === app.url)" name="checkmark-circle-fill" color="#B8C0C8" size="24"></u-icon>
  26. <u-icon v-else name="plus-circle-fill" color="#2979ff" size="24"></u-icon>
  27. </view>
  28. </view>
  29. </block>
  30. </view>
  31. </view>
  32. <view class="confirm-btn" @click="updateCommonApp">完成</view>
  33. </view>
  34. </template>
  35. <script>
  36. import { menus } from './app.js';
  37. export default {
  38. data() {
  39. return {
  40. now_list: [
  41. // {
  42. // url: '/pagesT/stock/SalesOrder',
  43. // label: '出库单',
  44. // icon: 'custom-icon-quehuoshangpinshu',
  45. // color: '#5c6aff',
  46. // access: 'InventoryOut'
  47. // },
  48. {
  49. url: '/pagesT/customer/StaffList',
  50. label: '销售排行',
  51. icon: 'custom-icon-paihangbang',
  52. color: '#f29611',
  53. access: 'salesRanking'
  54. },
  55. {
  56. url: '/pagesT/customer/CommunicationLogs',
  57. label: '客户拜访',
  58. icon: 'custom-icon-fuwu',
  59. color: '#f29611',
  60. access: 'CustomerListvisitedLogs'
  61. },
  62. {
  63. url: '/pagesT/customer/CommunicationLogs',
  64. label: '消耗品管理',
  65. icon: 'custom-icon-fuwu',
  66. color: '#f29611',
  67. access: 'CustomerListvisitedLogs'
  68. },
  69. {
  70. url: '/pagesT/customer/CommunicationLogs',
  71. label: '代客预约',
  72. icon: 'custom-icon-fuwu',
  73. color: '#f29611',
  74. access: 'CustomerListvisitedLogs'
  75. },
  76. {
  77. url: '/pagesT/customer/CommunicationLogs',
  78. label: '员工打卡',
  79. icon: 'custom-icon-fuwu',
  80. color: '#f29611',
  81. access: 'CustomerListvisitedLogs'
  82. },
  83. {
  84. url: '/pagesT/customer/CommunicationLogs',
  85. label: '门店员工',
  86. icon: 'custom-icon-fuwu',
  87. color: '#f29611',
  88. access: 'CustomerListvisitedLogs'
  89. },
  90. {
  91. url: '/pagesS/yg/gzdetail',
  92. label: '工资表',
  93. icon: 'custom-icon-fuwu',
  94. color: '#f29611',
  95. access: 'CustomerListvisitedLogs'
  96. },
  97. {
  98. url: '/pages/order/OrderAdd',
  99. label: '代客下单',
  100. icon: 'custom-icon-piliangxiadan',
  101. color: '#f29611',
  102. access: 'OrderAdd'
  103. },
  104. ],
  105. app_list: []
  106. };
  107. },
  108. computed: {
  109. userCenterId() {
  110. return this.$store.state.userInfo.userCenterId;
  111. },
  112. enterpriseScope() {
  113. return this.$store.state.enterprise.scope;
  114. }
  115. },
  116. onLoad() {
  117. if (parseInt(this.$store.state.enterprise.scope) === 4) {
  118. this.app_list = menus.map(item => {
  119. return{
  120. ...item,
  121. menuList:item.menuList.filter(menu=>menu.label !== '商品资料')
  122. }
  123. });
  124. } else {
  125. this.app_list = menus;
  126. }
  127. },
  128. onShow() {
  129. this.getCommonAppInfo();
  130. },
  131. methods: {
  132. chooseMenu(app) {
  133. const index = this.now_list.findIndex(menu => menu.url === app.url);
  134. if (index > -1) {
  135. if (this.now_list.length === 1) {
  136. this.$u.toast('最少保留一个应用');
  137. return;
  138. }
  139. this.now_list.splice(index, 1);
  140. } else {
  141. this.now_list.push(app);
  142. }
  143. },
  144. getCommonAppInfo() {
  145. this.$u.api.getCommonAppInfo(this.userCenterId).then(res => {
  146. if (res.data.jsonKey) {
  147. if(res.data.jsonKey[0].icon.indexOf('ibon')>-1){
  148. return
  149. }
  150. this.now_list = res.data.jsonKey;
  151. }
  152. });
  153. },
  154. updateCommonApp() {
  155. this.$u.api
  156. .updateCommonApp(this.userCenterId, {
  157. jsonKey: this.now_list
  158. })
  159. .then(res => {
  160. uni.navigateBack();
  161. });
  162. }
  163. }
  164. };
  165. </script>
  166. <style scoped lang="scss">
  167. .out-box {
  168. padding-bottom: 80rpx;
  169. }
  170. .app-view {
  171. .now-name {
  172. color: #333333;
  173. font-weight: bold;
  174. line-height: 80rpx;
  175. padding: 0 32rpx;
  176. }
  177. .menu-name {
  178. font-size: 24rpx;
  179. color: #879bba;
  180. line-height: 70rpx;
  181. padding: 0 32rpx;
  182. }
  183. .app-ul {
  184. display: flex;
  185. flex-wrap: wrap;
  186. background-color: #ffffff;
  187. padding-top: 40rpx;
  188. .app-li {
  189. text-align: center;
  190. width: 25%;
  191. margin-bottom: 40rpx;
  192. position: relative;
  193. .icon-circle {
  194. position: absolute;
  195. top: 0;
  196. right: 30rpx;
  197. height: 24rpx;
  198. width: 24rpx;
  199. line-height: 24rpx;
  200. }
  201. .icon-view {
  202. width: 72rpx;
  203. height: 72rpx;
  204. line-height: 72rpx;
  205. border-radius: 30rpx;
  206. margin: 0 auto;
  207. .custom-icon {
  208. font-size: 42rpx;
  209. color: #ffffff;
  210. }
  211. }
  212. .label {
  213. font-size: 24rpx;
  214. line-height: 36rpx;
  215. padding-top: 16rpx;
  216. color: #2d405e;
  217. }
  218. }
  219. }
  220. }
  221. .confirm-btn {
  222. background-color: $uni-color-primary;
  223. color: #ffffff;
  224. text-align: center;
  225. height: 80rpx;
  226. line-height: 80rpx;
  227. position: fixed;
  228. width: 100%;
  229. left: 0;
  230. bottom: 0;
  231. }
  232. </style>