特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
7.9 KiB

11 months ago
11 months ago
11 months ago
6 months ago
6 months ago
11 months ago
  1. <template>
  2. <!-- 电子合同 -->
  3. <view>
  4. <navbar title="电子合同" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="">
  6. <uv-tabs :list="tabs" lineColor="#3796F8" lineHeight="8rpx" lineWidth="50rpx" :scrollable="false"
  7. @click="clickTabs"></uv-tabs>
  8. </view>
  9. <view class="content">
  10. <view class="projectContent" v-for="(item, index) in list" :key="index">
  11. <view class="item">
  12. <image src="/static/image/contract/contract.png" mode="aspectFill" />
  13. <view class="itemList">
  14. <view class="projectName">
  15. {{ item.title }}
  16. <text class="status" :class="{
  17. 'status-pending': role ? item.bossStatus === 0 : item.employeeStatus === 0,
  18. 'status-signed': role ? item.bossStatus === 1 : item.employeeStatus === 1,
  19. 'status-completed': role ? item.bossStatus === 2 : item.employeeStatus === 2
  20. }">
  21. {{ role ?
  22. (item.bossStatus === 0 ? '待签署' : item.bossStatus === 1 ? '已签署' : '已完成') :
  23. (item.employeeStatus === 0 ? '待签署' : item.employeeStatus === 1 ? '已签署' : '已完成')
  24. }}
  25. </text>
  26. </view>
  27. <view class="buyer">甲方{{ item.companyName }}</view>
  28. <view class="seller">乙方{{ item.employeeName }}</view>
  29. </view>
  30. <view class="actions">
  31. <view class="view-btn" @click="showPDF(item)">
  32. <uv-icon name="eye" color="#2979ff" size="30rpx"></uv-icon>
  33. <text>查看</text>
  34. </view>
  35. <view class="sign-btn"
  36. v-if="(role && item.bossStatus === 0) || (!role && item.employeeStatus === 0)"
  37. @click.stop="$utils.navigateTo('/pages_order/contract/electronicSignature?id=' + item.id)">
  38. <uv-icon name="edit-pen" color="#fff" size="30rpx"></uv-icon>
  39. <text>签署</text>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import mixinList from '@/mixins/list.js'
  49. import { mapState } from 'vuex'
  50. export default {
  51. mixins: [mixinList],
  52. data() {
  53. return {
  54. tabs: [
  55. {
  56. name: '全部合同'
  57. },
  58. {
  59. name: '待我签署'
  60. },
  61. {
  62. name: '他人签署'
  63. },
  64. {
  65. name: '签约完成'
  66. },
  67. ],
  68. type: 0,
  69. mixinsListApi: 'queryContractList',
  70. contractUrl : '',
  71. }
  72. },
  73. computed: {
  74. },
  75. onLoad() {
  76. this.queryParams.role = this.role ? 1 : 0
  77. },
  78. methods: {
  79. clickTabs({ index }) {
  80. this.type = index
  81. if (index == 0) {
  82. delete this.queryParams.status
  83. }
  84. this.queryParams.status = index
  85. this.getData()
  86. },
  87. openPDF() {
  88. console.log(uni.getSystemInfoSync().platform);
  89. switch (uni.getSystemInfoSync().platform) {
  90. // case "android":
  91. // console.log("安卓");
  92. // this.androidOpenPdf(this.contractUrl);
  93. // break;
  94. // case "ios":
  95. // console.log("IOS");
  96. // uni.navigateTo({
  97. // url: "/pages_order/contract/webview?contractUrl=" + this.contractUrl,
  98. // });
  99. // break;
  100. default:
  101. this.androidOpenPdf(this.contractUrl);
  102. break;
  103. }
  104. },
  105. androidOpenPdf(filePath){
  106. uni.downloadFile({
  107. url: filePath,
  108. success: res => {
  109. console.log('下载PDF成功');
  110. uni.openDocument({
  111. filePath : res.filePath || res.tempFilePath,
  112. showMenu: true,
  113. })
  114. },
  115. fail(err) {
  116. console.log(err);
  117. }
  118. })
  119. },
  120. showPDF(item) {
  121. // this.$utils.
  122. // navigateTo('/pages_order/contract/contractDetail?id='
  123. // + item.id)
  124. this.contractUrl = item.contract
  125. // 只能查看内容的时候
  126. if (this.role && item.bossStatus != 0 ||
  127. item.employeeStatus != 0 && !this.role
  128. ) {
  129. this.openPDF()
  130. return
  131. }
  132. uni.showModal({
  133. title: '您希望的操作是?!',
  134. cancelText: '签署合同',
  135. confirmText: '查看内容',
  136. success: e => {
  137. if (e.confirm) {
  138. this.openPDF()
  139. } else {
  140. this.$utils.
  141. navigateTo('/pages_order/contract/electronicSignature?id='
  142. + item.id)
  143. }
  144. }
  145. })
  146. },
  147. }
  148. }
  149. </script>
  150. <style scoped lang="scss">
  151. .content {
  152. width: 100%;
  153. height: 100%;
  154. .projectContent {
  155. background-color: #fff;
  156. display: flex;
  157. margin: 30rpx;
  158. border-radius: 20rpx;
  159. .item {
  160. display: flex;
  161. width: 100%;
  162. padding: 20rpx;
  163. image {
  164. width: 140rpx;
  165. height: 120rpx;
  166. margin-right: 20rpx;
  167. }
  168. .itemList {
  169. flex: 1;
  170. .projectName {
  171. font-size: 32rpx;
  172. font-weight: bold;
  173. margin-bottom: 16rpx;
  174. display: flex;
  175. align-items: center;
  176. .status {
  177. font-size: 24rpx;
  178. padding: 4rpx 16rpx;
  179. border-radius: 20rpx;
  180. margin-left: 16rpx;
  181. &.status-pending {
  182. background-color: #E6F7FF;
  183. color: #1890FF;
  184. }
  185. &.status-signed {
  186. background-color: #F6FFED;
  187. color: #52C41A;
  188. }
  189. &.status-completed {
  190. background-color: #F5F5F5;
  191. color: #666666;
  192. }
  193. }
  194. }
  195. .buyer,
  196. .seller {
  197. font-size: 24rpx;
  198. color: #666;
  199. margin-top: 8rpx;
  200. }
  201. }
  202. .actions {
  203. display: flex;
  204. flex-direction: column;
  205. justify-content: center;
  206. gap: 16rpx;
  207. .view-btn,
  208. .sign-btn {
  209. display: flex;
  210. align-items: center;
  211. padding: 12rpx 24rpx;
  212. border-radius: 30rpx;
  213. background-color: #F0F7FF;
  214. text {
  215. color: #2979ff;
  216. font-size: 24rpx;
  217. margin-left: 8rpx;
  218. }
  219. }
  220. .sign-btn {
  221. background-color: #2979ff;
  222. text,
  223. uv-icon {
  224. color: #fff;
  225. }
  226. }
  227. }
  228. }
  229. }
  230. }
  231. </style>