contract_detail.vue 11 KB

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