index.vue 6.6 KB

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