index.vue 6.9 KB

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