index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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. onLoad() {
  98. this.getData();
  99. },
  100. methods: {
  101. getUserInfo() {
  102. this.http.request({
  103. url: '/app/user/info',
  104. success: (res) => {
  105. this.user = res.data.data;
  106. }
  107. });
  108. },
  109. getData() {
  110. this.http.request({
  111. url: '/app/home/contract',
  112. success: (res) => {
  113. this.contract = res.data.data;
  114. }
  115. });
  116. },
  117. go(url) {
  118. if (this.hasLogin()) {
  119. if (url == 'auth') {
  120. uni.navigateTo({ url: '/pages/user/auth' });
  121. }
  122. if (url == 'company' && this.user.isAuthentication === 1) {
  123. uni.navigateTo({ url: '/pages/statement/company/index' });
  124. }
  125. if (url == 'packages' && this.user.isCompany > 0 && this.user.isContract == 1) {
  126. uni.navigateTo({ url: '/pages/statement/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. if (url == 'info') {
  135. uni.navigateTo({ url: '/pages/statement/user/info' });
  136. }
  137. } else {
  138. uni.navigateTo({ url: '/pages/user/login' });
  139. }
  140. },
  141. selectClick(e) {
  142. if (e.name == '查看合同') {
  143. this.look();
  144. } else {
  145. this.$refs.sig.getSyncSignature();
  146. }
  147. },
  148. //查看合同
  149. look() {
  150. uni.showLoading({ title: '正在打开合同...', mask: true });
  151. uni.downloadFile({
  152. url: this.user.isContract == 0 ? this.ip + this.contract.url : this.ip + '/app/contract/look',
  153. header: { Authorization: this.getUser().token },
  154. success: (res) => {
  155. uni.openDocument({
  156. filePath: res.tempFilePath,
  157. showMenu: true,
  158. success: (res) => {
  159. uni.hideLoading();
  160. },
  161. fail: (res) => {
  162. uni.hideLoading();
  163. uni.showModal({ title: '提示', content: '打开合同失败', showCancel: false });
  164. }
  165. });
  166. },
  167. fail: (res) => {
  168. uni.hideLoading();
  169. }
  170. });
  171. },
  172. //电子签名
  173. sign(val) {
  174. this.http.request({
  175. url: '/app/contract/add',
  176. data: { contractId: this.contract.id, url: val },
  177. method: 'POST',
  178. success: (res) => {
  179. uni.showModal({
  180. title: '提示',
  181. content: '签约成功',
  182. showCancel: false,
  183. success: (res) => {
  184. this.getUserInfo();
  185. }
  186. });
  187. }
  188. });
  189. }
  190. }
  191. };
  192. </script>
  193. <style lang="scss">
  194. .main {
  195. padding: 5px 15px 15px 15px;
  196. }
  197. .banner {
  198. }
  199. .notice {
  200. margin-top: 10px;
  201. margin-bottom: -10px;
  202. }
  203. .flow {
  204. padding-top: 20px;
  205. .title {
  206. font-size: 15px;
  207. margin-bottom: 10px;
  208. }
  209. .item {
  210. border-radius: 10px;
  211. overflow: hidden;
  212. float: left;
  213. width: 50%;
  214. .out {
  215. padding: 5px;
  216. .int {
  217. padding: 15px;
  218. background-color: white;
  219. overflow: hidden;
  220. border-radius: 9px;
  221. text-align: center;
  222. height: 150px;
  223. .tb {
  224. margin: 0 auto;
  225. width: 40px;
  226. height: 40px;
  227. padding: 10px;
  228. line-height: 39px;
  229. color: $main-color;
  230. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  231. border-radius: 50%;
  232. font-size: 27px;
  233. }
  234. .con {
  235. padding-top: 8px;
  236. .bt {
  237. font-size: 18px;
  238. }
  239. .zt {
  240. font-size: 13px;
  241. padding-top: 5px;
  242. color: #909090;
  243. }
  244. }
  245. .state {
  246. padding-top: 11px;
  247. .zt {
  248. font-size: 13px;
  249. color: $main-color;
  250. }
  251. .icon {
  252. color: #909090;
  253. }
  254. .go {
  255. padding: 5px 12px;
  256. font-size: 14px;
  257. background-color: #5a7afc;
  258. color: white;
  259. border-radius: 20px;
  260. }
  261. }
  262. }
  263. }
  264. }
  265. }
  266. </style>