step1.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', '合同信息')
  4. <div class="w1200 m0a">
  5. <div class="right-titpos">
  6. <ul class="add-snav">
  7. <li class="active"><a href="#">合同信息</a></li>
  8. </ul>
  9. </div>
  10. <div id="app">
  11. <template>
  12. <div id="sign">
  13. <div class="box">
  14. <div class="right-head">
  15. <div class="right-head-con">合同基本信息</div>
  16. </div>
  17. <div style="padding-right: 50px">
  18. <el-form :model="ruleForm" ref="ruleForm" :rules="rules" label-width="140px" @submit.native.prevent class="demo-ruleForm">
  19. <el-form-item label="合同名称" prop="name">
  20. <el-input v-model.trim="ruleForm.name" placeholder="请输入合同名称"></el-input>
  21. </el-form-item>
  22. </el-form-item>
  23. <el-form-item label="签署主体">
  24. <el-radio-group v-model="ruleForm.sign_role_type" style="padding: 10px;">
  25. <el-radio :label="0">个人</el-radio>
  26. <el-radio :label="1">企业</el-radio>
  27. </el-radio-group>
  28. </el-form-item>
  29. <el-form-item label="平台角色">
  30. <el-select v-model="ruleForm.platform_role_id" placeholder="">
  31. <el-option v-for="item in platform_role_id_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="签署会员">
  35. <el-select
  36. v-model="contract_sign_uid"
  37. filterable
  38. remote
  39. placeholder="请输入昵称/姓名/手机号/ID"
  40. :remote-method="queryMembers"
  41. :loading="loading">
  42. <el-option
  43. v-for="item in sign_members"
  44. :key="item.uid"
  45. :label="item.nickname+'/'+item.realname+'/'+item.mobile"
  46. :value="item.uid">
  47. </el-option>
  48. </el-select>
  49. </el-form-item>
  50. </el-form>
  51. </div>
  52. </div>
  53. <div class="box">
  54. <div class="right-head">
  55. <div class="right-head-con">上传合同文件</div>
  56. </div>
  57. <div class="template-box">
  58. <el-row>
  59. <el-col :span="3">
  60. <div>合同文档</div>
  61. </el-col>
  62. <el-col :span="10">
  63. <el-upload v-if="!contract_doc_name" class="upload-demo" :show-file-list="false" :before-upload="beforeUpload1" :on-progress="onProgress1" ref="upload" :on-success="onSuccess" :on-error="onError" accept="application/pdf" :action="'{{yzWebUrl(\Yunshop\ShopEsign\admin\ContractController::UPLOAD_URL)}}'">
  64. <div v-show="progressFlag1" class="progress-box">
  65. <el-progress type="circle" :percentage="progressPercent1"></el-progress>
  66. </div>
  67. <div class="fileAddItem_1Vqb7" v-show="!progressFlag1">
  68. <i class="iconfont icon-adsystem_icon_add"></i>
  69. <p class="defaultInfoStyle_2mgdq">添加合同</p>
  70. </div>
  71. <div class="el-upload__tip" slot="tip">支持10M以内的pdf格式文件</div>
  72. </el-upload>
  73. <div style="height: 20px"></div>
  74. <div class="fileItemArea_2VWWl" v-if="contract_doc_name">
  75. <div class="imgPlaceholder_22teb">
  76. <div @mouseover="selectStyle" @mouseout="outStyle" v-show="currIndex == 1">
  77. <img src="../../assets/images/pdf.png" alt="">
  78. </div>
  79. <div @mouseover="selectStyle" @mouseout="outStyle" v-show="currIndex == 0">
  80. <img src="../../assets/images/search.png" alt="">
  81. </div>
  82. </div>
  83. <div class="fileInfoArea_3dGBW">
  84. <p class="fileName_25vmY">[[contract_doc_name]]</p>
  85. <p class="fileName_25vmY deleted" @click="deleteSingle"><i class="el-icon-delete"></i>删除</p>
  86. </div>
  87. </div>
  88. </el-col>
  89. </el-row>
  90. <el-row>
  91. <el-col :span="3">
  92. <div>合同附件</div>
  93. </el-col>
  94. <el-col :span="20">
  95. <el-upload class="upload-demo" :show-file-list="false" :before-upload="beforeUpload2" :on-progress="onProgress2" ref="upload" :on-success="onSuccess2" :on-error="onError" accept="application/pdf" :action="'{{yzWebUrl(\Yunshop\ShopEsign\admin\ContractController::UPLOAD_URL)}}'">
  96. <el-button size="small" type="primary">点击上传附件</el-button>
  97. <div class="el-upload__tip" slot="tip">支持10M以内的pdf格式文件</div>
  98. </el-upload>
  99. <div style="height: 20px"></div>
  100. <div class="fileItemArea_2VWWl" v-for="(item,index) in contract_attach" :key="index">
  101. <div class="imgPlaceholder_22teb">
  102. <div @mouseover="selectStyle" @mouseout="outStyle" v-show="currIndex == 1">
  103. <img src="../../assets/images/pdf.png" alt="">
  104. </div>
  105. <div @mouseover="selectStyle" @mouseout="outStyle" v-show="currIndex == 0">
  106. <img src="../../assets/images/search.png" alt="">
  107. </div>
  108. </div>
  109. <div class="fileInfoArea_3dGBW">
  110. <p class="fileName_25vmY">[[item.file_name]]</p>
  111. <p class="fileName_25vmY deleted" @click="deleteList(index)"><i class="el-icon-delete"></i>删除</p>
  112. </div>
  113. </div>
  114. <div v-show="progressFlag2" class="progress-box" style="display: inline-block;">
  115. <el-progress type="circle" :percentage="progressPercent2"></el-progress>
  116. </div>
  117. </el-col>
  118. </el-row>
  119. </div>
  120. </div>
  121. <div style="text-align: center">
  122. <el-button type="primary" style="width: 300px;" v-if="!id" @click="submitForm">下一步</el-button>
  123. <el-button type="primary" style="width: 300px;" v-else @click="submitForm('save')">下一步</el-button>
  124. </div>
  125. </div>
  126. </template>
  127. </div>
  128. <input type="hidden" id="get_detail_url" value="{{yzWebUrl(\Yunshop\ShopEsign\admin\ContractController::GET_DETAIL_URL)}}">
  129. <input type="hidden" id="edit_step1_url" value="{{yzWebUrl(\Yunshop\ShopEsign\admin\ContractController::EDIT_STEP1_URL)}}">
  130. <input type="hidden" id="add_step1_url" value="{{yzWebUrl(\Yunshop\ShopEsign\admin\ContractController::ADD_STEP1_URL)}}">
  131. <input type="hidden" id="step2_view_url" value="{{yzWebUrl(\Yunshop\ShopEsign\admin\ContractController::STEP2_VIEW_URL)}}">
  132. </div>
  133. <script>
  134. var app = new Vue({
  135. el: "#app",
  136. delimiters: ['[[', ']]'],
  137. data() {
  138. return {
  139. progressFlag1: false,
  140. progressFlag2: false,
  141. progressPercent1: 0,
  142. progressPercent2: 0,
  143. id: "",
  144. currIndex: 1,
  145. maxSize: 10 * 10224 * 1024, //10M
  146. contract_attach: [],
  147. contract_doc_name: "",
  148. contract_doc_url: "",
  149. platform_role_id:1,
  150. platform_role_id_list:[
  151. {
  152. 'id': 1,
  153. 'name': '甲方'
  154. },
  155. {
  156. 'id': 2,
  157. 'name': '乙方'
  158. }
  159. ],
  160. contract_sign_uid: 0,
  161. contract_sign_id:0,
  162. sign_members:[],
  163. ruleForm: {
  164. name: "",
  165. status: true,
  166. scene_id: 1,
  167. sign_role_type: 0,
  168. platform_role_id:1,
  169. contract_sign_uid:0
  170. },
  171. rules: {
  172. name: [{
  173. required: true,
  174. message: "请输入合同名称",
  175. trigger: "blur"
  176. }]
  177. }
  178. };
  179. },
  180. watch: {},
  181. created() {
  182. this.id = parseInt("{{$id}}");
  183. if (this.id) {
  184. this.getDeatil();
  185. }
  186. },
  187. destroyed() {},
  188. methods: {
  189. queryMembers(query) {
  190. let query_member_url = "{!!yzWebUrl('plugin.shop-esign.admin.member.queryJson')!!}";
  191. if (query) {
  192. this.$http.post(query_member_url, {
  193. keyword: query
  194. }, "loading").then(response => {
  195. if (response.data.result === 1) {
  196. this.sign_members = response.data.data;
  197. } else {
  198. this.$message.error(response.msg);
  199. }
  200. }).catch(err => {
  201. console.log(err);
  202. });
  203. }
  204. },
  205. getDeatil() {
  206. this.$http.post(document.getElementById("get_detail_url").value, {
  207. id: this.id
  208. }, "loading").then(response => {
  209. if (response.data.result === 1) {
  210. this.Data = response.data.data;
  211. this.ruleForm.name = this.Data.name;
  212. this.ruleForm.scene_id = this.Data.scene_id;
  213. this.ruleForm.sign_role_type = this.Data.sign_role_type;
  214. this.Data.status == 1 ? this.ruleForm.status = true : this.ruleForm.status = false;
  215. this.contract_doc_name = this.Data.contract_doc_name;
  216. this.contract_doc_url = this.Data.contract_doc_url;
  217. this.contract_attach = this.Data.contract_attach;
  218. this.ruleForm.platform_role_id = this.Data.platform_role_id?this.Data.platform_role_id:1;
  219. this.contract_sign_uid = this.Data.user_role_info.uid;
  220. this.contract_sign_id = this.Data.user_role_info.id;
  221. this.queryMembers(this.contract_sign_uid);
  222. } else {
  223. this.$message.error(response.msg);
  224. }
  225. }).catch(err => {
  226. console.log(err);
  227. });
  228. },
  229. selectStyle() {
  230. this.currIndex = 1;
  231. },
  232. outStyle() {
  233. this.currIndex = 1;
  234. },
  235. deleteSingle() {
  236. this.contract_doc_name = "";
  237. this.contract_doc_url = "";
  238. },
  239. deleteList(index) {
  240. this.contract_attach.splice(index, 1);
  241. },
  242. onProgress1(response, file, fileList) {
  243. this.progressPercent1 = Number(response.percent.toFixed(2))
  244. },
  245. onProgress2(response, file, fileList) {
  246. this.progressPercent2 = Number(response.percent.toFixed(2))
  247. },
  248. beforeUpload1(file) {
  249. if (file.size >= this.maxSize) {
  250. this.$message.error("文件大小超出10M");
  251. return false;
  252. }
  253. this.progressFlag1 = true
  254. },
  255. beforeUpload2(file) {
  256. if (file.size >= this.maxSize) {
  257. this.$message.error("文件大小超出10M");
  258. return false;
  259. }
  260. this.progressFlag2 = true
  261. },
  262. onSuccess(response, file, fileList) {
  263. if (this.progressPercent1 === 100) {
  264. this.progressFlag1 = false
  265. this.progressPercent1 = 0
  266. }
  267. if (!response.data.file_name) {
  268. this.$message.error(response.msg);
  269. }
  270. this.contract_doc_name = response.data.file_name;
  271. this.contract_doc_url = response.data.file_url;
  272. },
  273. onSuccess2(response, file, fileList) {
  274. if (this.progressPercent2 === 100) {
  275. this.progressFlag2 = false
  276. this.progressPercent2 = 0
  277. }
  278. if (!response.data.file_name) {
  279. this.$message.error(response.msg);
  280. }
  281. this.contract_attach.push(response.data);
  282. },
  283. onError() {
  284. this.progressFlag1 = false;
  285. this.progressFlag2 = false;
  286. this.progressPercent1 = 0;
  287. this.progressPercent2 = 0;
  288. this.$message.error("上传失败请重新上传");
  289. },
  290. submitForm(str) {
  291. if (!this.ruleForm.name) {
  292. this.$message.error("请先填写合同名称");
  293. return;
  294. }
  295. if (!this.contract_doc_url) {
  296. this.$message.error("请先上传合同文件");
  297. return;
  298. }
  299. let status = 0;
  300. this.ruleForm.status ? status = 1 : status = 0;
  301. let json = {
  302. name: this.ruleForm.name,
  303. status: status,
  304. scene_id: this.ruleForm.scene_id,
  305. sign_role_type: this.ruleForm.sign_role_type,
  306. contract_doc_name: this.contract_doc_name,
  307. contract_doc_url: this.contract_doc_url,
  308. contract_attach: this.contract_attach,
  309. platform_role_id: this.ruleForm.platform_role_id,
  310. contract_sign_uid:this.contract_sign_uid,
  311. contract_sign_id:this.contract_sign_id
  312. };
  313. let url = "";
  314. if (str == "save") {
  315. json.id = this.id;
  316. url = document.getElementById("edit_step1_url").value;
  317. } else {
  318. url = document.getElementById("add_step1_url").value;
  319. }
  320. this.$http.post(url, json, "loading").then(response => {
  321. if (response.data.result === 1) {
  322. let id = '';
  323. if (response.data.data.template_id) {
  324. id = response.data.data.template_id
  325. } else {
  326. id = this.id;
  327. }
  328. window.location.href = document.getElementById("step2_view_url").value + '&id=' + id;
  329. //this.$router.push(this.fun.getUrl("set_template",{id: id}));
  330. } else {
  331. this.$message.error(response.data.msg);
  332. }
  333. }).catch(err => {
  334. console.log(err);
  335. });
  336. }
  337. }
  338. })
  339. </script>
  340. <style>
  341. .el-upload input[type=file] {
  342. display: none !important;
  343. }
  344. #sign {
  345. padding: 30px;
  346. max-width: 1200px;
  347. margin: 0 auto;
  348. overflow: auto;
  349. }
  350. .right-head {
  351. line-height: 50px;
  352. border-bottom: 1px #ccc solid;
  353. margin-bottom: 15px;
  354. }
  355. .right-head .right-head-con {
  356. display: inline-block;
  357. padding-right: 20px;
  358. font-size: 16px;
  359. color: #888;
  360. }
  361. .box {
  362. margin-bottom: 30px;
  363. }
  364. .template-box {
  365. padding: 0 40px;
  366. font-size: 15px;
  367. }
  368. .gray {
  369. font-size: 14px;
  370. color: #9d9d9d;
  371. }
  372. .fileItemArea_2VWWl {
  373. position: relative;
  374. display: inline-block;
  375. width: 180px;
  376. height: 210px;
  377. margin: 0 10px 10px 0;
  378. border: 1px solid #dedede;
  379. background: #f9f9f9;
  380. }
  381. .fileItemArea_2VWWl .imgPlaceholder_22teb {
  382. position: relative;
  383. width: 120px;
  384. height: 130px;
  385. margin: 10px 30px 20px 30px;
  386. /*cursor: pointer;*/
  387. }
  388. .fileItemArea_2VWWl .imgPlaceholder_22teb img {
  389. width: 100%;
  390. height: 100%;
  391. }
  392. .fileItemArea_2VWWl .fileInfoArea_3dGBW {
  393. position: absolute;
  394. left: 0;
  395. bottom: 0;
  396. z-index: 10;
  397. width: 100%;
  398. height: 50px;
  399. background: #fff;
  400. border-top: 1px solid #dedede;
  401. user-select: none;
  402. }
  403. .fileItemArea_2VWWl .fileName_25vmY {
  404. margin: 0 5px;
  405. color: #333;
  406. line-height: 26px;
  407. font-size: 12px;
  408. overflow: hidden;
  409. text-overflow: ellipsis;
  410. white-space: nowrap;
  411. }
  412. .fileItemArea_2VWWl .deleted {
  413. cursor: pointer;
  414. text-align: right;
  415. }
  416. .fileAddItem_1Vqb7 {
  417. flex-direction: column;
  418. justify-content: center;
  419. width: 180px;
  420. height: 210px;
  421. border: 1px solid #e6e6e6;
  422. cursor: pointer;
  423. vertical-align: bottom;
  424. display: flex;
  425. align-items: center;
  426. margin-bottom: 10px;
  427. }
  428. .fileAddItem_1Vqb7 .defaultInfoStyle_2mgdq {
  429. font-size: 14px;
  430. color: #777;
  431. padding-top: 20px;
  432. }
  433. .fileAddItem_1Vqb7 p {
  434. margin: 0;
  435. }
  436. .fileAddItem_1Vqb7 i {
  437. font-size: 60px;
  438. color: #777;
  439. }
  440. .fileAddItem_1Vqb7:hover {
  441. border: 1px solid #409EFF;
  442. background-color: rgba(64, 158, 255, 0.07);
  443. }
  444. .fileAddItem_1Vqb7:hover .defaultInfoStyle_2mgdq {
  445. color: #409EFF;
  446. }
  447. .fileAddItem_1Vqb7:hover i {
  448. color: #409EFF;
  449. }
  450. </style>
  451. @endsection