index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="content">
  3. <view class="top">
  4. <view class="left">
  5. 用户名:
  6. <!-- <image src="../../static/logo.png" mode="widthFix" class="head-img"></image> -->
  7. </view>
  8. <view class="right">
  9. <view class="">
  10. {{userInfo.username}}
  11. </view>
  12. <!-- <view class="">
  13. 2022-12-2到期
  14. </view> -->
  15. </view>
  16. </view>
  17. <jobSelect ref="jobSelect" :listData="listData" @confirem="confiremJob" :typeOneData='typeOneData'
  18. :typeTwoData='typeTwoData'></jobSelect>
  19. <u-toast ref="uToast"></u-toast>
  20. </view>
  21. </template>
  22. <script>
  23. import {
  24. mapState
  25. } from 'vuex';
  26. import jobSelect from '@/components/yunmiao-jobSelect/yunmiao-jobSelect.vue'
  27. export default {
  28. components: {
  29. jobSelect
  30. },
  31. computed: {
  32. ...mapState(['hasLogin'])
  33. },
  34. onShow() {
  35. if (this.hasLogin || uni.getStorageSync("userInfo").username) {
  36. this.userInfo = uni.getStorageSync("userInfo")
  37. } else {
  38. uni.navigateTo({
  39. url: "/pages/login/login"
  40. })
  41. // uni.({
  42. // url: '/pages/index/index'
  43. // })
  44. }
  45. },
  46. data() {
  47. return {
  48. typeOneData: [],
  49. typeTwoData: [],
  50. userInfo: {},
  51. listData: [{
  52. "id": 1,
  53. "name": "餐饮",
  54. "children": [{
  55. "id": 2,
  56. "name": "服务员",
  57. }, {
  58. "id": 3,
  59. "name": "送餐员",
  60. }, {
  61. "id": 4,
  62. "name": "传菜员",
  63. },
  64. {
  65. "id": 5,
  66. "name": "厨师",
  67. }
  68. ]
  69. }, {
  70. "id": 6,
  71. "name": "家政保洁",
  72. "children": [{
  73. "id": 7,
  74. "name": "保洁",
  75. }, {
  76. "id": 8,
  77. "name": "保姆",
  78. }, {
  79. "id": 9,
  80. "name": "月嫂",
  81. }]
  82. }, {
  83. "id": 10,
  84. "name": "美容美发",
  85. "children": [{
  86. "id": 11,
  87. "name": "发型师",
  88. }]
  89. }],
  90. title: ''
  91. }
  92. },
  93. onLoad() {
  94. uni.showLoading({
  95. title: '数据加载中'
  96. })
  97. this.$request.baseRequest('admin.gubi.gubiTypeInfo', 'list', {
  98. page: 1,
  99. limit: 1000
  100. },
  101. failres => {
  102. console.log('res+++++', failres.errmsg)
  103. this.$refs.uToast.show({
  104. type: 'error',
  105. message: failres.errmsg,
  106. })
  107. uni.hideLoading()
  108. }).then(res => {
  109. // if (res.errno == 200) {
  110. uni.hideLoading()
  111. console.log(11)
  112. console.log(res.data.items)
  113. this.typeOneData = res.data.items
  114. this.$request.baseRequest('admin.gubi.gubiTypeSecond', 'list', {
  115. page: 1,
  116. limit: 1000,
  117. typeId: this.typeOneData[0].id
  118. },
  119. failres => {
  120. console.log('res+++++', failres.errmsg)
  121. this.$refs.uToast.show({
  122. type: 'error',
  123. message: failres.errmsg,
  124. })
  125. uni.hideLoading()
  126. }).then(res => {
  127. uni.hideLoading()
  128. console.log(11)
  129. console.log(res.data.items)
  130. this.typeTwoData = res.data.items
  131. })
  132. })
  133. // this.$request.baseRequest('admin.gubi.gubiTypeInfo', 'listInfo', failres => {
  134. // console.log('res+++++', failres.errmsg)
  135. // this.$refs.uToast.show({
  136. // type: 'error',
  137. // message: failres.errmsg,
  138. // })
  139. // uni.hideLoading()
  140. // }).then(res => {
  141. // // if (res.errno == 200) {
  142. // uni.hideLoading()
  143. // console.log(11)
  144. // console.log(res.data)
  145. // this.makeData(res.data)
  146. // // }
  147. // })
  148. // this.$refs.jobSelect.show()
  149. },
  150. methods: {
  151. makeData(val) {
  152. console.log(val)
  153. for (let i = 0; i < val.length; i++) {
  154. if (val[i].children) {
  155. for (let j = 0; j < val[i].children.length; j++) {
  156. let _obj = val[i].children[j]
  157. _obj.typeName = val[i].children[j].secondName
  158. val[i].children[j] = _obj
  159. if (val[i].children[j].children) {
  160. for (let k = 0; k < val[i].children[j].children.length; k++) {
  161. let _obj1 = val[i].children[j].children[k]
  162. _obj1.typeName = val[i].children[j].children[k].typeId
  163. val[i].children[j].children[k] = _obj1
  164. }
  165. }
  166. }
  167. }
  168. }
  169. this.listData = val
  170. // console.log(this.data)
  171. },
  172. // show() {
  173. // this.$refs.jobSelect.show()
  174. // },
  175. confiremJob(e) {
  176. console.log("e", e)
  177. uni.setStorageSync('selectInfo', e)
  178. uni.navigateTo({
  179. url: "/pages/index/price"
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style>
  186. .content {}
  187. .top {
  188. display: flex;
  189. background: #ececec;
  190. padding: 20rpx;
  191. position: fixed;
  192. z-index: 999;
  193. width: 100%;
  194. }
  195. .head-img {
  196. width: 100rpx;
  197. }
  198. </style>