confirmpaygoods.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. reciveTare: [{
  88. validator: (rule, value, callback) => {
  89. return !this.$u.test.isEmpty(value)
  90. },
  91. message: '皮重不能为空',
  92. trigger: ['change', 'blur']
  93. },
  94. {
  95. validator: (rule, value, callback) => {
  96. return this.$u.test.amount(value)
  97. },
  98. message: '数值类型,最多保留两位小数',
  99. trigger: ['change', 'blur'],
  100. },
  101. {
  102. validator: (rule, value, callback) => {
  103. return this.$u.test.range(value, [1, 100])
  104. },
  105. message: '数值类型,1-50之间',
  106. trigger: ['change', 'blur'],
  107. },
  108. ],
  109. },
  110. id: "",
  111. params: {
  112. year: true,
  113. month: true,
  114. day: true,
  115. },
  116. carNo: '',
  117. PageCur: "trust",
  118. TabCur: 0,
  119. priceTypeIndex: -1,
  120. priceType: ['库内价', '到库价', '到港价'],
  121. unitPrice: 0,
  122. price: '',
  123. seller: '',
  124. sellerPhone: '',
  125. minSale: '',
  126. exsitCount: 0,
  127. origin: '',
  128. stock: '',
  129. show: false,
  130. goodsName: '',
  131. verifyCode: '',
  132. sendText0: '获取验证码',
  133. sendText1: '获取验证码',
  134. sendText2: '获取验证码',
  135. sendText3: '获取验证码',
  136. sendDisabled0: false,
  137. sendDisabled1: false,
  138. sendDisabled2: false,
  139. sendDisabled3: false,
  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(option) {
  192. debugger
  193. this.goods = JSON.parse(option.toINfo)
  194. this.id = options.id
  195. this.goods.reciveCollectionScreenshot = this.goods.reciveCollectionScreenshot == null ? '' : this.goods
  196. .reciveCollectionScreenshot
  197. },
  198. methods: {
  199. DateChange(e) {
  200. this.goods.sendDateStart = e.year + '-' + e.month + '-' + e.day
  201. // this.goods.sendDateStart = e.detail.value
  202. },
  203. commit1(item) {
  204. uni.navigateTo({
  205. url: `/pageB/contract/look?id=${item.id}&netWeight=${item.netWeight}&carNo=${item.carNo}&sendDateStart=${item.sendDateStart}`
  206. })
  207. },
  208. grossWeightchange(e) {
  209. console.log(e);
  210. if (this.goods.reciveGrossWeight && this.goods.reciveTare) {
  211. this.goods.dispatchNetWeight = Number(
  212. this.goods.reciveGrossWeight - this.goods.reciveTare
  213. )
  214. }
  215. },
  216. tarechange(e) {
  217. if (this.goods.reciveGrossWeight && this.goods.reciveTare) {
  218. this.goods.dispatchNetWeight = Number(
  219. this.goods.reciveGrossWeight - this.goods.reciveTare
  220. )
  221. }
  222. },
  223. ChooseImagePerson() {
  224. uni.chooseImage({
  225. count: 1, //默认9
  226. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  227. sourceType: ['album', 'camera'], //从相册选择
  228. success: (res) => {
  229. //上传图片
  230. //图片路径可自行修改
  231. uploadImage(res.tempFilePaths[0], 'reciveCollectionScreenshot/',
  232. result => {
  233. debugger
  234. this.goods.reciveCollectionScreenshot = result
  235. uni.hideLoading();
  236. }
  237. )
  238. }
  239. });
  240. },
  241. DelImg(e) {
  242. uni.showModal({
  243. title: '提示',
  244. content: '确定要删除该照片吗?',
  245. cancelText: '取消',
  246. confirmText: '确定',
  247. success: res => {
  248. debugger
  249. if (res.confirm) {
  250. this.goods.reciveCollectionScreenshot = ""
  251. }
  252. }
  253. })
  254. },
  255. getList() {
  256. debugger
  257. this.utils.nullToString(this.goods)
  258. var that = this
  259. uni.showModal({
  260. content: '确定提交收货信息?',
  261. success: function(res) {
  262. if (res.confirm) {
  263. that.$api.doRequest('post',
  264. '/freightReceivingDispatching/api/confirmFreightReceivingDispatchingCar',
  265. that.goods).then(
  266. res => {
  267. if (res.data.code == 200) {
  268. debugger
  269. console.log(that.goods)
  270. uni.showModal({
  271. content: '提交成功!',
  272. success: function(res) {
  273. if (res.confirm) {
  274. that.$store.commit(
  275. 'configfreightTransport', true)
  276. uni.navigateTo({
  277. url: `/pageA/freightTransport/record/payrecord?id=` +
  278. this.id
  279. })
  280. // var result = that.goods.tranCarNo.substr(
  281. // that.goods.tranCarNo.indexOf("C") +
  282. // 1, that.goods.tranCarNo.length);
  283. // var num = Number(result) + 1
  284. // if (num <= 9) {
  285. // num = 'C00' + num
  286. // } else if (num < 100 && num > 9) {
  287. // num = 'C0' + num
  288. // } else if (num < 1000 && num > 99) {
  289. // num = 'C' + num
  290. // }
  291. // that.goods = {
  292. // tranCarNo: num,
  293. // carNo: '',
  294. // grossWeight: '',
  295. // tare: '',
  296. // loadNetWeight: '',
  297. // loadPoundImg: '',
  298. // contractNo: that.contractNo,
  299. // goodsName: that.goodsName,
  300. // sendDateStart: ''
  301. // }
  302. } else if (res.cancel) {
  303. // uni.navigateBack();
  304. }
  305. }
  306. });
  307. } else if (res.data.code == 11015) {
  308. // uni.showToast({
  309. // title: '该司机未认证身份,请司机认证后再操作',
  310. // icon: 'none',
  311. // duration: 2000
  312. // })
  313. }
  314. })
  315. .catch(res => {
  316. uni.showToast({
  317. title: res.errmsg,
  318. icon: 'none',
  319. duration: 2000
  320. })
  321. });
  322. } else if (res.cancel) {
  323. }
  324. }
  325. });
  326. },
  327. },
  328. }
  329. </script>
  330. <style scoped>
  331. .container {
  332. padding: 10px 10px;
  333. background-color: #F5F6FA;
  334. }
  335. .title1 {
  336. font-size: 18px;
  337. font-weight: 600;
  338. }
  339. .cu-form-group input {
  340. text-align: right;
  341. }
  342. .text-white text {
  343. background: linear-gradient(45deg, #3DC146, #B2D612);
  344. padding: 5px 10px;
  345. border-radius: 38rpx;
  346. }
  347. .cu-form-group textarea {
  348. text-align: right;
  349. }
  350. .commit {
  351. background: linear-gradient(45deg, #DF331C, #DA611A);
  352. color: #fff;
  353. }
  354. .c-row {
  355. display: -webkit-box;
  356. display: -webkit-flex;
  357. display: flex;
  358. -webkit-box-align: center;
  359. -webkit-align-items: center;
  360. align-items: center;
  361. padding: 20rpx 30rpx;
  362. position: relative;
  363. }
  364. .con-list {
  365. -webkit-box-flex: 1;
  366. -webkit-flex: 1;
  367. flex: 1;
  368. display: -webkit-box;
  369. display: -webkit-flex;
  370. display: flex;
  371. -webkit-box-orient: vertical;
  372. -webkit-box-direction: normal;
  373. -webkit-flex-direction: column;
  374. flex-direction: column;
  375. color: #303133;
  376. line-height: 40rpx;
  377. text-align: right;
  378. padding-right: 20rpx;
  379. font-size: 14px;
  380. }
  381. .information {
  382. background-color: #FFFFFF;
  383. border-radius: 20px;
  384. margin-top: 10px;
  385. }
  386. .btn {
  387. margin-top: 10px;
  388. border-radius: 25px;
  389. background-color: #22C572;
  390. border: none;
  391. color: #FFFFFF;
  392. }
  393. .uForm {
  394. padding: 0 40rpx;
  395. }
  396. </style>