index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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('contract')">
  47. <view class="icon tb">&#xe6ed;</view>
  48. <view class="con">
  49. <view class="bt">电子签约</view>
  50. <view class="bor" style="background: linear-gradient(to right, #f6f6bf, rgb(246 246 246))"></view>
  51. <view class="zt">{{ !user.isContract || user.isContract == 0 ? '尚未签约' : '已签约' }}</view>
  52. </view>
  53. <view class="state">
  54. <view class="go" :style="{ backgroundColor: user.isCompany > 0 ? '#5a7afc' : '#d6d6d6' }" v-if="!user.isContract || user.isContract == 0">去签约</view>
  55. <text class="icon" v-if="user.isContract == 1">&#xe62b;</text>
  56. </view>
  57. </view>
  58. <!--开始接包-->
  59. <view class="item" @click="go('packages')">
  60. <view class="icon tb">&#xe604;</view>
  61. <view class="con">
  62. <view class="bt">开始接包</view>
  63. <view class="bor" style="background: linear-gradient(to right, #c9f1d4, rgb(250 255 252))"></view>
  64. <view class="zt">{{ !user.isCompany || user.isCompany == 0 ? '请先完成上一步' : '去接包' }}</view>
  65. </view>
  66. <view class="state">
  67. <view class="go" :style="{ backgroundColor: user.isCompany > 0 && user.isContract == 1 ? '#5a7afc' : '#d6d6d6' }">去接包</view>
  68. </view>
  69. </view>
  70. </view>
  71. <u-action-sheet round="20" :actions="actions" @select="selectClick" cancelText="取消" :show="show" @close="show = false"></u-action-sheet>
  72. <signature ref="sig" @sign="sign" v-if=""></signature>
  73. </view>
  74. </template>
  75. <script>
  76. export default {
  77. data() {
  78. return {
  79. ip: this.http.ip,
  80. user: {},
  81. bannerList: [],
  82. noticeList: [],
  83. contract: {},
  84. show: false,
  85. actions: [{ name: '查看合同' }, { name: '去签字' }]
  86. };
  87. },
  88. onShow() {
  89. if (this.hasLogin()) {
  90. this.getUserInfo();
  91. }
  92. },
  93. onLoad() {
  94. this.getData();
  95. },
  96. methods: {
  97. getUserInfo() {
  98. this.http.request({
  99. url: '/app/user/info',
  100. success: (res) => {
  101. this.user = res.data.data;
  102. }
  103. });
  104. },
  105. getData() {
  106. this.http.request({
  107. url: '/app/home/index',
  108. success: (res) => {
  109. this.contract = res.data.data.contract;
  110. this.bannerList = res.data.data.bannerList;
  111. res.data.data.noticeList.forEach((item) => {
  112. this.noticeList.push(item.title);
  113. });
  114. }
  115. });
  116. },
  117. go(url) {
  118. if (this.hasLogin()) {
  119. if (url == 'auth') {
  120. uni.navigateTo({ url: '/pages/auth/index' });
  121. }
  122. if (url == 'company' && this.user.isAuthentication === 1) {
  123. uni.navigateTo({ url: '/pages/company/index' });
  124. }
  125. if (url == 'packages' && this.user.isCompany > 0 && this.user.isContract == 1) {
  126. uni.switchTab({ url: '/pages/packages/index' });
  127. }
  128. if (url == 'contract' && this.user.isContract == 1) {
  129. this.look();
  130. }
  131. } else {
  132. uni.navigateTo({ url: '/pages/user/login' });
  133. }
  134. },
  135. selectClick(e) {
  136. if (e.name == '查看合同') {
  137. this.look();
  138. } else {
  139. this.$refs.sig.getSyncSignature();
  140. }
  141. },
  142. //查看合同
  143. look() {
  144. uni.downloadFile({
  145. url: this.user.isContract == 0 ? this.ip + this.contract.url : this.ip + '/app/contract/look',
  146. header: { Authorization: this.getUser().token },
  147. success: (res) => {
  148. uni.openDocument({
  149. filePath: res.tempFilePath,
  150. showMenu: true,
  151. success: (res) => {}
  152. });
  153. }
  154. });
  155. },
  156. //电子签名
  157. sign(val) {
  158. this.http.request({
  159. url: '/app/contract/add',
  160. data: { contractId: 35, url: val },
  161. method: 'POST',
  162. success: (res) => {
  163. uni.showModal({
  164. title: '提示',
  165. content: '签约成功',
  166. showCancel: false,
  167. success: (res) => {
  168. this.getUserInfo();
  169. }
  170. });
  171. }
  172. });
  173. }
  174. }
  175. };
  176. </script>
  177. <style lang="scss">
  178. .main {
  179. padding: 5px 15px 15px 15px;
  180. }
  181. .banner {
  182. }
  183. .notice {
  184. margin-top: 10px;
  185. }
  186. .flow {
  187. padding-top: 20px;
  188. .title {
  189. font-size: 15px;
  190. }
  191. .item {
  192. background-color: white;
  193. border-radius: 10px;
  194. padding: 18px;
  195. overflow: hidden;
  196. margin-top: 12px;
  197. .tb {
  198. float: left;
  199. padding: 13px;
  200. border: 1px solid $main-color;
  201. color: $main-color;
  202. border-radius: 50%;
  203. font-size: 23px;
  204. }
  205. .con {
  206. float: left;
  207. padding-left: 20px;
  208. .bt {
  209. font-size: 18px;
  210. }
  211. .bor {
  212. background-color: red;
  213. border-radius: 20px;
  214. height: 9px;
  215. margin-top: -9px;
  216. width: 105px;
  217. margin-left: -5px;
  218. }
  219. .zt {
  220. font-size: 13px;
  221. padding-top: 5px;
  222. color: #909090;
  223. }
  224. }
  225. .state {
  226. float: right;
  227. padding-top: 11px;
  228. .zt {
  229. font-size: 13px;
  230. color: $main-color;
  231. }
  232. .icon {
  233. color: #909090;
  234. }
  235. .go {
  236. padding: 5px 12px;
  237. font-size: 14px;
  238. background-color: #5a7afc;
  239. color: white;
  240. border-radius: 20px;
  241. }
  242. }
  243. }
  244. }
  245. </style>