index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. if (url == 'contract' && this.user.isContract == 0) {
  132. this.show = true;
  133. }
  134. } else {
  135. uni.navigateTo({ url: '/pages/user/login' });
  136. }
  137. },
  138. selectClick(e) {
  139. if (e.name == '查看合同') {
  140. this.look();
  141. } else {
  142. this.$refs.sig.getSyncSignature();
  143. }
  144. },
  145. //查看合同
  146. look() {
  147. uni.downloadFile({
  148. url: this.user.isContract == 0 ? this.ip + this.contract.url : this.ip + '/app/contract/look',
  149. header: { Authorization: this.getUser().token },
  150. success: (res) => {
  151. uni.openDocument({
  152. filePath: res.tempFilePath,
  153. showMenu: true,
  154. success: (res) => {}
  155. });
  156. }
  157. });
  158. },
  159. //电子签名
  160. sign(val) {
  161. this.http.request({
  162. url: '/app/contract/add',
  163. data: { contractId: this.contract.id, url: val },
  164. method: 'POST',
  165. success: (res) => {
  166. uni.showModal({
  167. title: '提示',
  168. content: '签约成功',
  169. showCancel: false,
  170. success: (res) => {
  171. this.getUserInfo();
  172. }
  173. });
  174. }
  175. });
  176. }
  177. }
  178. };
  179. </script>
  180. <style lang="scss">
  181. .main {
  182. padding: 5px 15px 15px 15px;
  183. }
  184. .banner {
  185. }
  186. .notice {
  187. margin-top: 10px;
  188. }
  189. .flow {
  190. padding-top: 20px;
  191. .title {
  192. font-size: 15px;
  193. }
  194. .item {
  195. background-color: white;
  196. border-radius: 10px;
  197. padding: 18px;
  198. overflow: hidden;
  199. margin-top: 12px;
  200. .tb {
  201. float: left;
  202. padding: 13px;
  203. border: 1px solid $main-color;
  204. color: $main-color;
  205. border-radius: 50%;
  206. font-size: 23px;
  207. }
  208. .con {
  209. float: left;
  210. padding-left: 20px;
  211. .bt {
  212. font-size: 18px;
  213. }
  214. .bor {
  215. background-color: red;
  216. border-radius: 20px;
  217. height: 9px;
  218. margin-top: -9px;
  219. width: 105px;
  220. margin-left: -5px;
  221. }
  222. .zt {
  223. font-size: 13px;
  224. padding-top: 5px;
  225. color: #909090;
  226. }
  227. }
  228. .state {
  229. float: right;
  230. padding-top: 11px;
  231. .zt {
  232. font-size: 13px;
  233. color: $main-color;
  234. }
  235. .icon {
  236. color: #909090;
  237. }
  238. .go {
  239. padding: 5px 12px;
  240. font-size: 14px;
  241. background-color: #5a7afc;
  242. color: white;
  243. border-radius: 20px;
  244. }
  245. }
  246. }
  247. }
  248. </style>