contract.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <template>
  2. <view class="container">
  3. <!-- <block v-if="TabCur==2"> -->
  4. <view v-for="(item , index) in lists" :Key="index">
  5. <view class="cu-form-group">
  6. <view class="title">采购</view>
  7. <text style="margin-left: -30%;">编号{{item.contractNo}}{{item.procurementPlanType}}</text>
  8. <text>{{item.status}}</text>
  9. </view>
  10. <view class="cu-form-group">
  11. <view class="title">买方</view>
  12. <text style="margin-left: -45%;">{{item.customer}}</text>
  13. <text></text>
  14. </view>
  15. <view class="cu-form-group">
  16. <view class="title">玉米:<text>{{item.goodsName}}</text></view>
  17. <view class="title">单价:<text>{{item.unitPrice}}</text></view>
  18. <view class="title">基差:<text>{{item.basis}}</text></view>
  19. </view>
  20. <view class="c-row b-b">
  21. <text><button class="cu-btn commit margin-tb-sm lg" style=" width: 75px;height: 25px; margin-left: 15px;"
  22. @click="commit">附件</button></text>
  23. <text><button class="cu-btn commit margin-tb-sm lg" style=" margin-left: 15px; width: 75px;height: 25px;"
  24. @click="commit">点价</button></text>
  25. <text><button class="cu-btn commit margin-tb-sm lg" style=" margin-left: 15px; width: 75px;height: 25px;"
  26. @click="commit1(item)">发货</button></text>
  27. </view>
  28. </view>
  29. <hr>
  30. <!-- <view class="cu-form-group">
  31. <view class="title">采购</view>
  32. <text style="margin-left: -30%;">编号{{goods.contractNo}}{{goods.procurementPlanType}}</text>
  33. <text>{{goods.status}}</text>
  34. </view>
  35. <view class="cu-form-group">
  36. <view class="title">买方</view>
  37. <text style="margin-left: -45%;">{{goods.customer}}</text>
  38. <text></text>
  39. </view>
  40. <view class="cu-form-group">
  41. <view class="title">玉米:<text>{{goods.goodsName}}</text></view>
  42. <view class="title">单价:<text>{{goods.unitPrice}}</text></view>
  43. <view class="title">基差:<text>{{goods.basis}}</text></view>
  44. </view>
  45. <view class="cu-form-group">
  46. <view class="title">
  47. </view>
  48. </view>
  49. <view class="c-row b-b">
  50. <text><button class="cu-btn commit margin-tb-sm lg" style=" width: 75px;height: 25px; margin-left: 15px;"
  51. @click="commit">附件</button>
  52. </text>
  53. <text><button class="cu-btn commit margin-tb-sm lg" style=" margin-left: 15px; width: 75px;height: 25px;"
  54. @click="commit">点价</button></text>
  55. </view> -->
  56. <view class="cu-bar bg-white margin-top">
  57. <view class="action">
  58. </view>
  59. </view>
  60. <view class="padding flex flex-direction">
  61. <!-- <button class="cu-btn commit margin-tb-sm lg" @click="commit">提交</button> -->
  62. </view>
  63. <!-- </block> -->
  64. </view>
  65. </template>
  66. <script>
  67. import uploadImage from '@/components/ossutil/uploadFile.js';
  68. import {
  69. mapState
  70. } from 'vuex';
  71. export default {
  72. name: "trust",
  73. data() {
  74. return {
  75. lists:[],
  76. goods: {
  77. pageSize:10,
  78. currentPage:1,
  79. id:"41651544",
  80. // pcFlag : 0,
  81. },
  82. procurementPlanInfo:{
  83. pageSize:10,
  84. currentPage:1
  85. },
  86. tran: {
  87. total: 0,
  88. price: 0,
  89. startPlace: undefined,
  90. endPlace: undefined,
  91. goodsName: undefined,
  92. sender: '',
  93. senderPhone: '',
  94. status: 0,
  95. receiver: '',
  96. receiverPhone: '',
  97. verifyCode: '',
  98. driver: '',
  99. driverPhone: '',
  100. carNo: '',
  101. personNoImg: '',
  102. personNoImg1: '',
  103. driverNoImg: '',
  104. driverNoImg1: '',
  105. carNoImg: '',
  106. carNoImg1: ''
  107. },
  108. PageCur: "trust",
  109. TabCur: 0,
  110. priceTypeIndex: -1,
  111. priceType: ['库内价', '到库价', '到港价'],
  112. unitPrice: 0,
  113. price: '',
  114. seller: '',
  115. sellerPhone: '',
  116. minSale: '',
  117. exsitCount: 0,
  118. origin: '',
  119. stock: '',
  120. goodsName: '',
  121. verifyCode: '',
  122. sendText0: '获取验证码',
  123. sendText1: '获取验证码',
  124. sendText2: '获取验证码',
  125. sendText3: '获取验证码',
  126. sendDisabled0: false,
  127. sendDisabled1: false,
  128. sendDisabled2: false,
  129. sendDisabled3: false,
  130. buyer: '',
  131. buyerPhone: '',
  132. level: '',
  133. sender: '',
  134. senderPhone: '',
  135. receiver: '',
  136. receiverPhone: '',
  137. total: 0,
  138. startPlace: '',
  139. endPlace: '',
  140. driver: '',
  141. driverPhone: '',
  142. carNo: '',
  143. personNoImg: '',
  144. personNoImg1: '',
  145. driverNoImg: '',
  146. driverNoImg1: '',
  147. carNoImg: '',
  148. carNoImg1: '',
  149. showTran: true
  150. };
  151. },
  152. computed: {
  153. ...mapState(['hasLogin', 'userInfo'])
  154. },
  155. // onShow() {
  156. // this.loadData()
  157. // },
  158. onLoad(){
  159. this.getList()
  160. },
  161. methods: {
  162. commit1(item){
  163. uni.navigateTo({
  164. url: `/pageB/contract/look?id=${item.id}&contractNo=${item.contractNo}&customer=${item.customer}&goodsName=${item.goodsName}`
  165. })
  166. },
  167. getList(){
  168. this.goods.commonId = this.userInfo.id
  169. this.$api.doRequest('get','/purchaseOrder/selectPurchaseOrder',this.goods).then(res => {
  170. console.log(res,"fanhuijie")
  171. this.lists = res.data.data.records
  172. console.log("调用接口")
  173. that.sendDisabled = true
  174. let sec = 60
  175. let interval = setInterval(() => {
  176. sec--;
  177. that.sendText = sec + 's后重发'
  178. if (sec <= 0) {
  179. that.sendDisabled = false
  180. that.sendText = "获取验证码"
  181. clearInterval(interval)
  182. }
  183. }, 1000)
  184. })
  185. .catch(res => {
  186. uni.showToast({
  187. title: res.errmsg,
  188. icon:'none',
  189. duration: 2000
  190. })
  191. });
  192. },
  193. ChooseImageCar() {
  194. uni.chooseImage({
  195. count: 1, //默认9
  196. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  197. sourceType: ['album', 'camera'], //从相册选择
  198. success: (res) => {
  199. //上传图片
  200. //图片路径可自行修改
  201. uploadImage(res.tempFilePaths[0], 'carNoImg/',
  202. result => {
  203. if (this.carNoImg.length != 0) {
  204. this.carNoImg1 = result
  205. } else {
  206. this.carNoImg = result
  207. }
  208. uni.hideLoading();
  209. }
  210. )
  211. }
  212. });
  213. },
  214. ViewImage(e) {
  215. var img = [];
  216. img = e.currentTarget.dataset.url.split(' ')
  217. uni.previewImage({
  218. current: 0,
  219. urls: img
  220. });
  221. },
  222. // DelImg(e) {
  223. // uni.showModal({
  224. // title: '提示',
  225. // content: '确定要删除该照片吗?',
  226. // cancelText: '取消',
  227. // confirmText: '确定',
  228. // success: res => {
  229. // if (res.confirm) {
  230. // if (e.currentTarget.dataset.index == 0) {
  231. // this.personNoImg = "";
  232. // } else if (e.currentTarget.dataset.index == 1) {
  233. // this.personNoImg1 = "";
  234. // } else if (e.currentTarget.dataset.index == 2) {
  235. // this.driverNoImg = "";
  236. // } else if (e.currentTarget.dataset.index == 3) {
  237. // this.driverNoImg1 = "";
  238. // } else if (e.currentTarget.dataset.index == 4) {
  239. // this.carNoImg = "";
  240. // } else if (e.currentTarget.dataset.index == 5) {
  241. // this.carNoImg1 = "";
  242. // }
  243. // }
  244. // }
  245. // })
  246. // },
  247. commit11() {
  248. if (this.hasLogin) {
  249. uni.showModal({
  250. title: '登录提示',
  251. content: '您尚未登录,是否立即登录?',
  252. showCancel: true,
  253. confirmText: '登录',
  254. success: (e) => {
  255. if (e.confirm) {
  256. uni.navigateTo({
  257. url: '/pagesB/contract/look'
  258. })
  259. }
  260. },
  261. fail: () => {},
  262. complete: () => {}
  263. })
  264. }
  265. else {
  266. const that = this
  267. if (this.TabCur == 0) {
  268. // if (!that.seller) {
  269. // this.$api.msg('请填写卖方');
  270. // return;
  271. // }
  272. // if (!that.sellerPhone) {
  273. // this.$api.msg('请填写手机号码');
  274. // return;
  275. // }
  276. // if (!that.exsitCount) {
  277. // this.$api.msg('请填写库存量');
  278. // return;
  279. // }
  280. // if (!that.minSale) {
  281. // this.$api.msg('请填写最小成交量');
  282. // return;
  283. // }
  284. // if (!that.goodsName) {
  285. // this.$api.msg('请填写货名');
  286. // return;
  287. // }
  288. // if (!that.verifyCode) {
  289. // this.$api.msg('请填写验证码');
  290. // return;
  291. // }
  292. // if (!that.price) {
  293. // that.$api.msg('请选择价格类型')
  294. // return
  295. // }
  296. // if (!that.unitPrice) {
  297. // that.$api.msg('请填写协议价格(元/吨)');
  298. // return
  299. // }
  300. // if (!that.origin) {
  301. // this.$api.msg('请填写产地');
  302. // return;
  303. // }
  304. // if (!that.stock) {
  305. // this.$api.msg('请填写库存地');
  306. // return;
  307. // }
  308. // if (!that.level) {
  309. // this.$api.msg('请填写国标等级');
  310. // return;
  311. // }
  312. // that.saleInfo.seller = that.seller
  313. // that.saleInfo.sellerPhone = that.sellerPhone
  314. // that.saleInfo.priceType = that.price
  315. // that.saleInfo.unitPrice = that.unitPrice
  316. // that.saleInfo.minSale = that.minSale
  317. // that.saleInfo.exsitCount = that.exsitCount
  318. // that.saleInfo.origin = that.origin
  319. // that.saleInfo.stock = that.stock
  320. // that.saleInfo.verifyCode = that.verifyCode
  321. // that.saleInfo.goodsName = that.goodsName
  322. // that.saleInfo.buyer = that.buyer
  323. // that.saleInfo.buyerPhone = that.buyerPhone
  324. // that.saleInfo.level = that.level
  325. } else if (this.TabCur == 1) {
  326. if (!that.buyer) {
  327. this.$api.msg('请填写买方');
  328. return;
  329. }
  330. if (!that.buyerPhone) {
  331. this.$api.msg('请填写手机号码');
  332. return;
  333. }
  334. if (!that.goodsName) {
  335. this.$api.msg('请填写货名');
  336. return;
  337. }
  338. if (!that.verifyCode) {
  339. this.$api.msg('请填写验证码');
  340. return;
  341. }
  342. if (!that.price) {
  343. that.$api.msg('请选择价格类型')
  344. return
  345. }
  346. if (!that.unitPrice) {
  347. that.$api.msg('请填写协议价格(元/吨)');
  348. return
  349. }
  350. if (!that.origin) {
  351. this.$api.msg('请填写产地');
  352. return;
  353. }
  354. if (!that.stock) {
  355. this.$api.msg('请填写库存地');
  356. return;
  357. }
  358. if (!that.level) {
  359. this.$api.msg('请填写国标等级');
  360. return;
  361. }
  362. that.saleInfo.seller = that.seller
  363. that.saleInfo.sellerPhone = that.sellerPhone
  364. that.saleInfo.priceType = that.price
  365. that.saleInfo.unitPrice = that.unitPrice
  366. that.saleInfo.minSale = that.minSale
  367. that.saleInfo.exsitCount = that.exsitCount
  368. that.saleInfo.origin = that.origin
  369. that.saleInfo.stock = that.stock
  370. that.saleInfo.verifyCode = that.verifyCode
  371. that.saleInfo.goodsName = that.goodsName
  372. that.saleInfo.buyer = that.buyer
  373. that.saleInfo.buyerPhone = that.buyerPhone
  374. that.saleInfo.level = that.level
  375. } else if (this.TabCur == 2) {
  376. if (!that.sender) {
  377. this.$api.msg('请填写发货方');
  378. return;
  379. }
  380. if (!that.senderPhone) {
  381. this.$api.msg('请填写发货方手机号码');
  382. return;
  383. }
  384. if (!that.receiver) {
  385. this.$api.msg('请填写收货方');
  386. return;
  387. }
  388. if (!that.receiverPhone) {
  389. this.$api.msg('请填写收货方手机号码');
  390. return;
  391. }
  392. if (!that.goodsName) {
  393. this.$api.msg('请填写货名');
  394. return;
  395. }
  396. if (!that.verifyCode) {
  397. this.$api.msg('请填写验证码');
  398. return;
  399. }
  400. that.tran.sender = that.sender
  401. that.tran.senderPhone = that.senderPhone
  402. that.tran.receiver = that.receiver
  403. that.tran.receiverPhone = that.receiverPhone
  404. that.tran.verifyCode = that.verifyCode
  405. that.tran.goodsName = that.goodsName
  406. that.tran.total = that.total
  407. that.tran.price = that.price
  408. that.tran.startPlace = that.startPlace
  409. that.tran.endPlace = that.endPlace
  410. } else if (this.TabCur == 3) {
  411. if (!that.startPlace) {
  412. this.$api.msg('请填写起始地');
  413. return;
  414. }
  415. if (!that.endPlace) {
  416. this.$api.msg('请填写目的地');
  417. return;
  418. }
  419. if (!that.driver) {
  420. this.$api.msg('请填写承运人');
  421. return;
  422. }
  423. if (!that.driverPhone) {
  424. this.$api.msg('请填写承运人手机号码');
  425. return;
  426. }
  427. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(that.driverPhone)) {
  428. that.$api.msg('请输入正确的承运人手机号码');
  429. return
  430. }
  431. if (!that.carNo) {
  432. this.$api.msg('请填写车牌号');
  433. return;
  434. }
  435. if (!that.verifyCode) {
  436. this.$api.msg('请填写验证码');
  437. return;
  438. }
  439. if (!that.personNoImg || !that.personNoImg1) {
  440. that.$api.msg('请上传身份证正、反面照片');
  441. return
  442. }
  443. if (!that.driverNoImg || !that.driverNoImg1) {
  444. that.$api.msg('请上传驾驶证主、副页照片');
  445. return
  446. }
  447. if (!that.carNoImg || !that.carNoImg1) {
  448. that.$api.msg('请上传行车证主、副页照片');
  449. return
  450. }
  451. that.tran.driver = that.driver
  452. that.tran.driverPhone = that.driverPhone
  453. that.tran.verifyCode = that.verifyCode
  454. that.tran.price = that.price
  455. that.tran.startPlace = that.startPlace
  456. that.tran.endPlace = that.endPlace
  457. that.tran.carNo = that.carNo
  458. that.tran.personNoImg = that.personNoImg
  459. that.tran.personNoImg1 = that.personNoImg1
  460. that.tran.driverNoImg = that.driverNoImg
  461. that.tran.driverNoImg1 = that.driverNoImg1
  462. that.tran.carNoImg = that.carNoImg
  463. that.tran.carNoImg1 = that.carNoImg1
  464. }
  465. // 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问”
  466. wx.getSetting({
  467. // withSubscriptions: true,//是否获取用户订阅消息的订阅状态,默认false不返回
  468. success(res) {
  469. if (res.authSetting['scope.subscribeMessage']) {
  470. uni.openSetting({ // 打开设置页
  471. success(res) {
  472. console.log(res.authSetting)
  473. }
  474. });
  475. } else { // 用户没有点击“总是保持以上,不再询问”则每次都会调起订阅消息
  476. uni.requestSubscribeMessage({
  477. tmplIds: ['8cVkckXi_8zfHeScXRHhjN6cgZFYYCWIMPDTiPWagXY'], //
  478. success(res) {
  479. console.log(res)
  480. if (res['8cVkckXi_8zfHeScXRHhjN6cgZFYYCWIMPDTiPWagXY'] ==
  481. "accept") { // 字段就是tmplIds模板id
  482. uni.showLoading({
  483. title: '正在提交',
  484. mask: true
  485. })
  486. if (that.TabCur == 0) {
  487. that.$api.request('sale', 'addSale', that.saleInfo,
  488. failres => {
  489. uni.hideLoading()
  490. that.$api.msg(failres.errmsg);
  491. }).then(res => {
  492. uni.hideLoading()
  493. uni.showModal({
  494. title: '提示',
  495. content: "发布提交成功,工作人员会尽快联系该号码:" +
  496. that.sellerPhone,
  497. showCancel: false,
  498. confirmText: '确定',
  499. success: () => {
  500. uni.navigateBack()
  501. }
  502. })
  503. // that.$api.prePage().refreshList(data, that.manageType);
  504. })
  505. } else if (that.TabCur == 1) {
  506. that.$api.request('sale', 'addBuy', that.saleInfo,
  507. failres => {
  508. uni.hideLoading()
  509. that.$api.msg(failres.errmsg);
  510. }).then(res => {
  511. uni.hideLoading()
  512. uni.showModal({
  513. title: '提示',
  514. showCancel: false,
  515. content: "发布提交成功,工作人员会尽快联系该号码:" +
  516. that.buyerPhone,
  517. confirmText: '确定',
  518. success: () => {
  519. uni.navigateBack()
  520. }
  521. })
  522. // that.$api.prePage().refreshList(data, that.manageType);
  523. })
  524. } else if (that.TabCur == 2) {
  525. that.$api.request('tran', 'addTran', that.tran,
  526. failres => {
  527. uni.hideLoading()
  528. that.$api.msg(failres.errmsg);
  529. }).then(res => {
  530. uni.hideLoading()
  531. uni.showModal({
  532. title: '提示',
  533. showCancel: false,
  534. content: "发布提交成功,工作人员会尽快联系该号码:" +
  535. that.senderPhone,
  536. confirmText: '确定',
  537. success: () => {
  538. uni.navigateBack()
  539. }
  540. })
  541. // that.$api.prePage().refreshList(data, that.manageType);
  542. })
  543. } else if (that.TabCur == 3) {
  544. that.$api.request('tran', 'addCarDriver', that.tran,
  545. failres => {
  546. uni.hideLoading()
  547. that.$api.msg(failres.errmsg);
  548. }).then(res => {
  549. uni.hideLoading()
  550. uni.showModal({
  551. title: '提示',
  552. showCancel: false,
  553. content: "发布提交成功,工作人员会尽快联系该号码:" +
  554. that.driverPhone,
  555. confirmText: '确定',
  556. success: () => {
  557. uni.navigateBack()
  558. }
  559. })
  560. // that.$api.prePage().refreshList(data, that.manageType);
  561. })
  562. }
  563. }
  564. }
  565. })
  566. }
  567. }
  568. })
  569. }
  570. }
  571. },
  572. }
  573. </script>
  574. <style scoped>
  575. .zan-dialog__mask {
  576. position: fixed;
  577. top: 0;
  578. left: 0;
  579. right: 0;
  580. bottom: 0;
  581. z-index: 10;
  582. background: rgba(0, 0, 0, 0); /*设置阴影半透明背景如: background: rgba(0, 0, 0, 0.4);*/
  583. display: none;
  584. }
  585. .zan-dialog__container {
  586. position: fixed;
  587. bottom: 400rpx;
  588. width: 650rpx; /*弹窗布局宽*/
  589. height: 350rpx; /*弹窗布局高,与下面弹出距离transform有关*/
  590. margin-left: 50rpx;
  591. background: #f8f8f8;
  592. transform: translateY(300%); /*弹框弹出距离,与弹框布局高度有关,如300%表示弹起距离为3倍弹窗高度 */
  593. transition: all 0.4s ease;
  594. z-index: 12;
  595. border-radius: 20rpx;
  596. box-shadow: 0px 3px 3px 2px gainsboro; /*弹框的悬浮阴影效果,如不需要可注释该行*/
  597. }
  598. .zan-dialog--show .zan-dialog__container {
  599. transform: translateY(0);
  600. }
  601. .zan-dialog--show .zan-dialog__mask {
  602. display: block;
  603. }
  604. .container {
  605. padding-bottom: 160rpx;
  606. }
  607. .cu-form-group input {
  608. text-align: right;
  609. }
  610. .text-white text {
  611. background: linear-gradient(45deg, #3DC146, #B2D612);
  612. padding: 5px 10px;
  613. border-radius: 38rpx;
  614. }
  615. .cu-form-group textarea {
  616. text-align: right;
  617. }
  618. .commit {
  619. background: linear-gradient(45deg, #DF331C, #DA611A);
  620. color: #fff;
  621. }
  622. </style>