index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="main">
  3. <!--轮播图-->
  4. <view class="banner">
  5. <u-swiper circular :radius="5" :indicator="true" keyName="pic" :list="bannerList" :height="150" class="uni-swiper" @click="click"></u-swiper>
  6. </view>
  7. <!--通知公告-->
  8. <view class="notice">
  9. <u-notice-bar color="#848484" :text="noticeList" :step="true" direction="column" mode="link" bgColor="white" speed="300" url="/pages/notice/index"></u-notice-bar>
  10. </view>
  11. <view class="flow">
  12. <view class="title">操作流程</view>
  13. <!--实名认证-->
  14. <view class="item" @click="go('auth')">
  15. <view class="icon tb">&#xe600;</view>
  16. <view class="con">
  17. <view class="bt">实名认证</view>
  18. <view class="bor" style="background: linear-gradient(to right, rgb(198 187 250), rgb(251 251 251))"></view>
  19. <view class="zt">{{ !user.isAuthentication || user.isAuthentication == 0 ? '尚未提交资料' : '已提交资料' }}</view>
  20. </view>
  21. <view class="state" v-if="user.isAuthentication === 1">
  22. <text class="zt">已认证</text>
  23. <text class="icon">&#xe62b;</text>
  24. </view>
  25. <view class="state" v-else>
  26. <view class="go">去认证</view>
  27. </view>
  28. </view>
  29. <!--关联企业-->
  30. <view class="item" @click="go('company')">
  31. <view class="icon tb">&#xe623;</view>
  32. <view class="con">
  33. <view class="bt">关联企业</view>
  34. <view class="bor" style="background: linear-gradient(to right, #eecce0, rgb(253 253 253))"></view>
  35. <view class="zt">{{ !user.isCompany || user.isCompany == 0 ? '尚未关联企业' : '已完成' }}</view>
  36. </view>
  37. <view class="state" v-if="user.isCompany > 0">
  38. <text class="zt">{{ user.isCompany }}家</text>
  39. <text class="icon">&#xe62b;</text>
  40. </view>
  41. <view class="state" v-else>
  42. <view class="go" :style="{ backgroundColor: user.isAuthentication === 1 ? '#5a7afc' : '#d6d6d6' }">去关联</view>
  43. </view>
  44. </view>
  45. <!--开始接包-->
  46. <view class="item" @click="go('packages')">
  47. <view class="icon tb">&#xe604;</view>
  48. <view class="con">
  49. <view class="bt">开始接包</view>
  50. <view class="bor" style="background: linear-gradient(to right, #c9f1d4, rgb(250 255 252))"></view>
  51. <view class="zt">{{ !user.isCompany || user.isCompany == 0 ? '请先完成上一步' : '去接包' }}</view>
  52. </view>
  53. <view class="state">
  54. <view class="go" :style="{ backgroundColor: user.isCompany > 0 ? '#5a7afc' : '#d6d6d6' }">去接包</view>
  55. </view>
  56. </view>
  57. <!--电子签约-->
  58. <view class="item" @click="go('contract')">
  59. <view class="icon tb">&#xe6ed;</view>
  60. <view class="con">
  61. <view class="bt">电子签约</view>
  62. <view class="bor" style="background: linear-gradient(to right, #f6f6bf, rgb(246 246 246))"></view>
  63. <view class="zt">{{ !user.isContract || user.isContract == 0 ? '请签约' : '已签约' }}</view>
  64. </view>
  65. <view class="state">
  66. <view class="go" :style="{ backgroundColor: user.isCompany > 0 ? '#5a7afc' : '#d6d6d6' }">去签约</view>
  67. </view>
  68. </view>
  69. </view>
  70. <u-action-sheet round="20" :actions="actions" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. ip: this.http.ip,
  78. user: {},
  79. bannerList: [],
  80. noticeList: [],
  81. show: false,
  82. actions: [{ name: '查看合同' }, { name: '去签字' }]
  83. };
  84. },
  85. onShow() {
  86. if (this.hasLogin()) {
  87. this.getUser();
  88. }
  89. },
  90. onLoad() {
  91. this.getData();
  92. },
  93. methods: {
  94. getUser() {
  95. this.http.request({
  96. url: '/app/user/info',
  97. success: (res) => {
  98. this.user = res.data.data;
  99. }
  100. });
  101. },
  102. getData() {
  103. this.http.request({
  104. url: '/app/home/index',
  105. success: (res) => {
  106. this.bannerList = res.data.data.bannerList;
  107. res.data.data.noticeList.forEach((item) => {
  108. this.noticeList.push(item.title);
  109. });
  110. }
  111. });
  112. },
  113. go(url) {
  114. if (this.hasLogin()) {
  115. if (url == 'auth') {
  116. uni.navigateTo({ url: '/pages/auth/index' });
  117. }
  118. if (url == 'company' && this.user.isAuthentication === 1) {
  119. uni.navigateTo({ url: '/pages/company/index' });
  120. }
  121. if (url == 'packages' && this.user.isCompany > 0) {
  122. uni.switchTab({ url: '/pages/packages/index' });
  123. }
  124. if (url == 'contract' && this.user.isContract == 0) {
  125. this.show = true;
  126. }
  127. } else {
  128. uni.navigateTo({ url: '/pages/user/login' });
  129. }
  130. },
  131. selectClick(e) {
  132. if (e.name == '查看合同') {
  133. uni.downloadFile({
  134. url: this.ip + '/profile/upload/2024/04/24/承揽合同_20240424004417A002.docx',
  135. success: (res) => {
  136. // 下载成功后返回的临时文件路径
  137. let filePath = res.tempFilePath;
  138. // 打开临时文件
  139. uni.openDocument({
  140. filePath: filePath,
  141. showMenu: true,
  142. success: (res) => {
  143. console.log('打开文档成功');
  144. }
  145. });
  146. },
  147. fail: (err) => {}
  148. });
  149. } else {
  150. console.log('合同签字');
  151. }
  152. }
  153. }
  154. };
  155. </script>
  156. <style lang="scss">
  157. .main {
  158. padding: 5px 15px 15px 15px;
  159. }
  160. .banner {
  161. }
  162. .notice {
  163. margin-top: 10px;
  164. }
  165. .flow {
  166. padding-top: 20px;
  167. .title {
  168. font-size: 15px;
  169. }
  170. .item {
  171. background-color: white;
  172. border-radius: 10px;
  173. padding: 18px;
  174. overflow: hidden;
  175. margin-top: 12px;
  176. .tb {
  177. float: left;
  178. padding: 13px;
  179. border: 1px solid $main-color;
  180. color: $main-color;
  181. border-radius: 50%;
  182. font-size: 23px;
  183. }
  184. .con {
  185. float: left;
  186. padding-left: 20px;
  187. .bt {
  188. font-size: 18px;
  189. }
  190. .bor {
  191. background-color: red;
  192. border-radius: 20px;
  193. height: 9px;
  194. margin-top: -9px;
  195. width: 105px;
  196. margin-left: -5px;
  197. }
  198. .zt {
  199. font-size: 13px;
  200. padding-top: 5px;
  201. color: #909090;
  202. }
  203. }
  204. .state {
  205. float: right;
  206. padding-top: 11px;
  207. .zt {
  208. font-size: 13px;
  209. color: $main-color;
  210. }
  211. .icon {
  212. color: #909090;
  213. }
  214. .go {
  215. padding: 5px 12px;
  216. font-size: 14px;
  217. background-color: #5a7afc;
  218. color: white;
  219. border-radius: 20px;
  220. }
  221. }
  222. }
  223. }
  224. </style>