confirmpaygoods.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. <template>
  2. <view class="container">
  3. <view class="information">
  4. <u-form :model="goods" ref="uForm" class="uForm">
  5. <u-form-item label="车牌号" prop="carNo" label-width="120" required>
  6. <u-input v-model="goods.carNo" input-align="right" disabled placeholder="请输入车牌号" maxlength='7' />
  7. </u-form-item>
  8. <u-form-item label="毛重(吨)" prop="reciveGrossWeight" label-width="120" required>
  9. <u-input v-model="goods.reciveGrossWeight" input-align="right" placeholder="请输入毛重"
  10. @input="grossWeightchange" />
  11. </u-form-item>
  12. <u-form-item label="皮重(吨)" prop="reciveTare" label-width="120" required>
  13. <u-input v-model="goods.reciveTare" input-align="right" placeholder="请输入皮重" @input="tarechange" />
  14. </u-form-item>
  15. <u-form-item label="净重(吨)" prop="dispatchNetWeight" label-width="120" required>
  16. <u-input v-model="goods.dispatchNetWeight" disabled input-align="right" placeholder="自动计算" />
  17. </u-form-item>
  18. </u-form>
  19. </view>
  20. <view class="information">
  21. <view class="c-row">
  22. <view class="action">
  23. 上传磅单照片
  24. </view>
  25. </view>
  26. <view class="c-row">
  27. <view class="grid col-4 grid-square flex-sub">
  28. <view class="bg-img" v-if="goods.reciveCollectionScreenshot != ''" @tap="ViewImage"
  29. :data-url="goods.reciveCollectionScreenshot">
  30. <image :src="goods.reciveCollectionScreenshot" mode="aspectFit"></image>
  31. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="0">
  32. <text class='cuIcon-close'></text>
  33. </view>
  34. </view>
  35. <view class="solids" @tap="ChooseImagePerson" v-if="goods.reciveCollectionScreenshot == ''">
  36. <text class='cuIcon-cameraadd'></text>
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. <button class="btn btns" @click="getList">提交</button>
  42. <!-- </block> -->
  43. </view>
  44. </template>
  45. <script>
  46. import uploadImage from '@/components/ossutil/uploadFile.js';
  47. import {
  48. mapState
  49. } from 'vuex';
  50. export default {
  51. name: "trust",
  52. data() {
  53. return {
  54. goods: {
  55. reciveCollectionScreenshot: ''
  56. },
  57. rules: {
  58. carNo: [{
  59. validator: (rule, value, callback) => {
  60. return !this.$u.test.carNo(value)
  61. },
  62. message: '车牌号格式不正确',
  63. trigger: ['change', 'blur']
  64. }, ],
  65. reciveGrossWeight: [{
  66. validator: (rule, value, callback) => {
  67. return !this.$u.test.isEmpty(value)
  68. },
  69. message: '毛重不能为空',
  70. trigger: ['change', 'blur']
  71. },
  72. {
  73. validator: (rule, value, callback) => {
  74. return this.$u.test.amount(value)
  75. },
  76. message: '数值类型,最多保留两位小数',
  77. trigger: ['change', 'blur'],
  78. },
  79. {
  80. validator: (rule, value, callback) => {
  81. return this.$u.test.range(value, [1, 100])
  82. },
  83. message: '数值类型,1-100之间',
  84. trigger: ['change', 'blur'],
  85. },
  86. // {
  87. // validator: (rule, value, callback) => {
  88. // if(parseInt(value)>this.goods.reciveNetWeight) return false
  89. // return true
  90. // },
  91. // message: '收货毛重不能大于发货净重',
  92. // trigger: ['change', 'blur'],
  93. // },
  94. ],
  95. reciveTare: [{
  96. validator: (rule, value, callback) => {
  97. return !this.$u.test.isEmpty(value)
  98. },
  99. message: '皮重不能为空',
  100. trigger: ['change', 'blur']
  101. },
  102. {
  103. validator: (rule, value, callback) => {
  104. return this.$u.test.amount(value)
  105. },
  106. message: '数值类型,最多保留两位小数',
  107. trigger: ['change', 'blur'],
  108. },
  109. {
  110. validator: (rule, value, callback) => {
  111. return this.$u.test.range(value, [1, 100])
  112. },
  113. message: '数值类型,1-50之间',
  114. trigger: ['change', 'blur'],
  115. }
  116. ]
  117. },
  118. id: "",
  119. params: {
  120. year: true,
  121. month: true,
  122. day: true,
  123. },
  124. carNo: '',
  125. PageCur: "trust",
  126. TabCur: 0,
  127. priceTypeIndex: -1,
  128. priceType: ['库内价', '到库价', '到港价'],
  129. unitPrice: 0,
  130. price: '',
  131. seller: '',
  132. sellerPhone: '',
  133. minSale: '',
  134. exsitCount: 0,
  135. origin: '',
  136. stock: '',
  137. show: false,
  138. goodsName: '',
  139. verifyCode: '',
  140. buyer: '',
  141. buyerPhone: '',
  142. level: '',
  143. sender: '',
  144. senderPhone: '',
  145. receiver: '',
  146. receiverPhone: '',
  147. total: 0,
  148. startPlace: '',
  149. endPlace: '',
  150. driver: '',
  151. driverPhone: '',
  152. carNo: '',
  153. personNoImg: '',
  154. personNoImg1: '',
  155. driverNoImg: '',
  156. driverNoImg1: '',
  157. carNoImg: '',
  158. carNoImg1: '',
  159. goodsName: '',
  160. showTran: true
  161. };
  162. },
  163. computed: {
  164. ...mapState(['hasLogin', 'userInfo']),
  165. time() {
  166. var date = new Date()
  167. var year = date.getFullYear()
  168. var month = date.getMonth()
  169. var date1 = date.getDate()
  170. if (month + 1 < 10) {
  171. month = "0" + (month + 1)
  172. }
  173. if (date1 + 1 < 10) {
  174. date1 = "0" + date1
  175. }
  176. return year + '-' + month + "-" + date1
  177. },
  178. startDate() {
  179. //限制开始时间;
  180. //也可以直接限定为当天日期 var date= new Date(); return date
  181. return new Date(new Date(new Date().toLocaleDateString()).getTime() - (1 * 60 * 60 * 1000))
  182. },
  183. endDate() {
  184. return new Date()
  185. }
  186. },
  187. onShow() {},
  188. onReady() {
  189. this.$refs.uForm.setRules(this.rules);
  190. },
  191. onLoad(options) {
  192. this.goods = JSON.parse(options.toINfo)
  193. this.id = options.id;
  194. this.goods.reciveCollectionScreenshot = this.goods.reciveCollectionScreenshot == null ? '':this.goods.reciveCollectionScreenshot
  195. },
  196. methods: {
  197. DateChange(e) {
  198. this.goods.sendDateStart = e.year + '-' + e.month + '-' + e.day
  199. // this.goods.sendDateStart = e.detail.value
  200. },
  201. commit1(item) {
  202. uni.navigateTo({
  203. url: `/pageB/contract/look?id=${item.id}&netWeight=${item.netWeight}&carNo=${item.carNo}&sendDateStart=${item.sendDateStart}`
  204. })
  205. },
  206. grossWeightchange(e) {
  207. console.log(e);
  208. if (this.goods.reciveGrossWeight && this.goods.reciveTare) {
  209. this.goods.dispatchNetWeight = Number(
  210. this.goods.reciveGrossWeight - this.goods.reciveTare
  211. )
  212. }
  213. },
  214. tarechange(e) {
  215. if (this.goods.reciveGrossWeight && this.goods.reciveTare) {
  216. this.goods.dispatchNetWeight = Number(
  217. this.goods.reciveGrossWeight - this.goods.reciveTare
  218. )
  219. }
  220. },
  221. ChooseImagePerson() {
  222. uni.chooseImage({
  223. count: 1, //默认9
  224. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  225. sourceType: ['album', 'camera'], //从相册选择
  226. success: (res) => {
  227. //上传图片
  228. //图片路径可自行修改
  229. uploadImage(res.tempFilePaths[0], 'reciveCollectionScreenshot/',
  230. result => {
  231. this.goods.reciveCollectionScreenshot = result
  232. uni.hideLoading();
  233. }
  234. )
  235. }
  236. });
  237. },
  238. DelImg(e) {
  239. uni.showModal({
  240. title: '提示',
  241. content: '确定要删除该照片吗?',
  242. cancelText: '取消',
  243. confirmText: '确定',
  244. success: res => {
  245. if (res.confirm) {
  246. this.goods.reciveCollectionScreenshot = ""
  247. }
  248. }
  249. })
  250. },
  251. getList() {
  252. this.utils.nullToString(this.goods)
  253. var that = this
  254. uni.showModal({
  255. content: '确定提交收货信息?',
  256. success: function(res) {
  257. if (res.confirm) {
  258. that.goods.reciveGrossWeight = parseInt(that.goods.reciveGrossWeight)
  259. that.goods.reciveTare = parseInt(that.goods.reciveTare)
  260. that.$api.doRequest('post',
  261. '/freightReceivingDispatching/api/confirmFreightReceivingDispatchingCar',
  262. that.goods).then(
  263. res => {
  264. if (res.data.code == 200) {
  265. console.log(that.goods)
  266. uni.showModal({
  267. content: '提交成功!',
  268. success: function(res) {
  269. if (res.confirm) {
  270. that.$store.commit(
  271. 'configfreightTransport', false)
  272. uni.navigateTo({
  273. url: `/pageA/freightTransport/record/payrecord?id=` +that.id
  274. })
  275. // var result = that.goods.tranCarNo.substr(
  276. // that.goods.tranCarNo.indexOf("C") +
  277. // 1, that.goods.tranCarNo.length);
  278. // var num = Number(result) + 1
  279. // if (num <= 9) {
  280. // num = 'C00' + num
  281. // } else if (num < 100 && num > 9) {
  282. // num = 'C0' + num
  283. // } else if (num < 1000 && num > 99) {
  284. // num = 'C' + num
  285. // }
  286. // that.goods = {
  287. // tranCarNo: num,
  288. // carNo: '',
  289. // grossWeight: '',
  290. // tare: '',
  291. // loadNetWeight: '',
  292. // loadPoundImg: '',
  293. // contractNo: that.contractNo,
  294. // goodsName: that.goodsName,
  295. // sendDateStart: ''
  296. // }
  297. } else if (res.cancel) {
  298. // uni.navigateBack();
  299. }
  300. }
  301. });
  302. } else if (res.data.code == 11015) {
  303. // uni.showToast({
  304. // title: '该司机未认证身份,请司机认证后再操作',
  305. // icon: 'none',
  306. // duration: 2000
  307. // })
  308. }
  309. })
  310. .catch(res => {
  311. if(res.errmsg){
  312. uni.showToast({
  313. title: res.errmsg,
  314. icon: 'none',
  315. duration: 2000
  316. })
  317. }
  318. else{
  319. uni.showToast({
  320. title: "系统异常,请联系管理员",
  321. icon: 'none',
  322. duration: 2000
  323. })
  324. }
  325. });
  326. } else if (res.cancel) {
  327. }
  328. }
  329. });
  330. },
  331. },
  332. }
  333. </script>
  334. <style scoped>
  335. .container {
  336. padding: 10px 10px;
  337. background-color: #F5F6FA;
  338. }
  339. .title1 {
  340. font-size: 18px;
  341. font-weight: 600;
  342. }
  343. .cu-form-group input {
  344. text-align: right;
  345. }
  346. .text-white text {
  347. background: linear-gradient(45deg, #3DC146, #B2D612);
  348. padding: 5px 10px;
  349. border-radius: 38rpx;
  350. }
  351. .cu-form-group textarea {
  352. text-align: right;
  353. }
  354. .commit {
  355. background: linear-gradient(45deg, #DF331C, #DA611A);
  356. color: #fff;
  357. }
  358. .c-row {
  359. display: -webkit-box;
  360. display: -webkit-flex;
  361. display: flex;
  362. -webkit-box-align: center;
  363. -webkit-align-items: center;
  364. align-items: center;
  365. padding: 20rpx 30rpx;
  366. position: relative;
  367. }
  368. .con-list {
  369. -webkit-box-flex: 1;
  370. -webkit-flex: 1;
  371. flex: 1;
  372. display: -webkit-box;
  373. display: -webkit-flex;
  374. display: flex;
  375. -webkit-box-orient: vertical;
  376. -webkit-box-direction: normal;
  377. -webkit-flex-direction: column;
  378. flex-direction: column;
  379. color: #303133;
  380. line-height: 40rpx;
  381. text-align: right;
  382. padding-right: 20rpx;
  383. font-size: 14px;
  384. }
  385. .information {
  386. background-color: #FFFFFF;
  387. border-radius: 20px;
  388. margin-top: 10px;
  389. }
  390. .btn {
  391. margin-top: 10px;
  392. border-radius: 25px;
  393. background-color: #22C572;
  394. border: none;
  395. color: #FFFFFF;
  396. }
  397. .uForm {
  398. padding: 0 40rpx;
  399. }
  400. </style>