short_track_addition.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <view>
  3. <view>
  4. <view class='wrap'>
  5. <view class="c-row">
  6. <view class="title">车牌号</view>
  7. <view class="con-list">
  8. <input v-model='detailData.carNo' placeholder="请输入车牌号" maxlength="7"></input>
  9. </view>
  10. </view>
  11. </view>
  12. <view @click='startTrack' class="button" v-if='titleBtn=="开始轨迹"'>{{titleBtn}}</view>
  13. <view @click='startTrack' class="button1" v-if='titleBtn=="结束轨迹"'>{{titleBtn}}</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. detailData: {
  22. carNo: '',
  23. travelStatus: '',
  24. originProvince: '',
  25. originCity: '',
  26. originArea: '',
  27. originLongitude: '',
  28. originLatitude: '',
  29. destinationProvince: '',
  30. destinationCity: '',
  31. destinationArea: '',
  32. destinationLongitude: '',
  33. destinationLatitude: '',
  34. trackFlag: '0',
  35. compId: '',
  36. commonId: '',
  37. mileage: '',
  38. sendWarehouse:'',
  39. receiveWarehouse:'',
  40. },
  41. titleBtn: "开始轨迹",
  42. }
  43. },
  44. onLoad(options) {
  45. this.id = options.id
  46. },
  47. onShow() {
  48. var that = this
  49. if (this.id) {
  50. this.seeInfo()
  51. }
  52. },
  53. methods: {
  54. seeInfo() {
  55. this.$api.doRequest('get', '/shortFillingInfo/getShortFilling', {
  56. id: this.id
  57. }).then(res => {
  58. if (res.data.code == 200) {
  59. this.detailData = res.data.data
  60. if (this.detailData.travelStatus == "已开始") {
  61. this.titleBtn = "结束轨迹"
  62. }
  63. }
  64. })
  65. },
  66. startTrack() {
  67. if(this.detailData.carNo.length!=7){
  68. this.$api.msg('车牌号输入错误!')
  69. return
  70. }
  71. if (this.titleBtn == "开始轨迹") {
  72. var that = this
  73. uni.showModal({
  74. content: "确定开始轨迹?",
  75. showCancel: true,
  76. confirmText: '确定',
  77. success: function(res) {
  78. if (res.confirm) {
  79. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  80. that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
  81. that.detailData.driverName = uni.getStorageSync('userInfo').userName
  82. that.detailData.trackFlag = "0"
  83. that.detailData.fillingNo = "202207040004"
  84. that.detailData.originProvince = "黑龙江省"
  85. that.detailData.originCity = "齐齐哈尔市"
  86. that.detailData.originArea = "克东县"
  87. that.detailData.sendWarehouse = "克东千丰库"
  88. that.detailData.originLongitude = "123.188"
  89. that.detailData.originLatitude = "41.737"
  90. that.$api.doRequest('post', '/shortFillingInfo/api/addShortFilling',
  91. that.detailData
  92. )
  93. .then(res => {
  94. that.id = res.data.data
  95. if (res.data.code == 200) {
  96. that.$api.msg('提交成功')
  97. that.titleBtn = "结束轨迹"
  98. } else {
  99. that.$api.msg('提交失败')
  100. }
  101. })
  102. }
  103. }
  104. })
  105. } else if (this.titleBtn == "结束轨迹") {
  106. var that = this
  107. uni.showModal({
  108. content: "确定结束轨迹?",
  109. showCancel: true,
  110. confirmText: '确定',
  111. success: function(res) {
  112. if (res.confirm) {
  113. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  114. that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
  115. that.detailData.driverName = uni.getStorageSync('userInfo').userName
  116. that.detailData.trackFlag = "1"
  117. that.detailData.destinationProvince = "辽宁省"
  118. that.detailData.receiveWarehouse = "鲅鱼圈红运库"
  119. that.detailData.carNo
  120. that.detailData.mileage = "15"
  121. that.detailData.destinationLongitude = "118.291"
  122. that.detailData.destinationLatitude = "33.942"
  123. that.$api.doRequest('post', '/shortFillingInfo/api/addShortFilling',
  124. that.detailData
  125. )
  126. .then(res => {
  127. if (res.data.code == 200) {
  128. that.$api.msg('提交成功')
  129. uni.navigateTo({
  130. url: '/pages/shortDistance/short_distance_record'
  131. })
  132. } else {
  133. that.$api.msg('提交失败')
  134. }
  135. })
  136. }
  137. }
  138. })
  139. }
  140. },
  141. }
  142. }
  143. </script>
  144. <style lang='scss' scoped>
  145. page {
  146. background: #F5F6FA;
  147. }
  148. .title_b {
  149. margin: 20rpx 20rpx 0rpx 20rpx;
  150. padding: 20rpx 10rpx 20rpx 10rpx;
  151. font-size: 18px;
  152. font-weight: 550;
  153. }
  154. .c-row {
  155. display: -webkit-box;
  156. display: -webkit-flex;
  157. display: flex;
  158. -webkit-box-align: center;
  159. -webkit-align-items: center;
  160. align-items: center;
  161. padding: 20rpx 30rpx;
  162. }
  163. .con-list {
  164. -webkit-box-flex: 1;
  165. -webkit-flex: 1;
  166. flex: 1;
  167. display: -webkit-box;
  168. display: -webkit-flex;
  169. display: flex;
  170. -webkit-box-orient: vertical;
  171. -webkit-box-direction: normal;
  172. -webkit-flex-direction: column;
  173. flex-direction: column;
  174. color: #303133;
  175. line-height: 40rpx;
  176. text-align: right;
  177. padding-right: 20rpx;
  178. }
  179. .wrap {
  180. font-size: 14px;
  181. background: #fff;
  182. margin: 10px;
  183. border-radius: 15px 10px;
  184. input {
  185. font-size: 14px;
  186. }
  187. >.title {
  188. padding: 10px 16px;
  189. }
  190. }
  191. .button {
  192. background: #22C572;
  193. width: 90%;
  194. margin: 250px auto;
  195. padding: 10px;
  196. color: #fff;
  197. text-align: center;
  198. border-radius: 30px;
  199. }
  200. .button1 {
  201. background: #ff0000;
  202. width: 90%;
  203. margin: 250px auto;
  204. padding: 10px;
  205. color: #fff;
  206. text-align: center;
  207. border-radius: 30px;
  208. }
  209. .buns_item {
  210. display: flex;
  211. padding: 80rpx 0 50rpx 0;
  212. justify-content: space-around;
  213. }
  214. .but_css {
  215. background: #22C572;
  216. width: 40%;
  217. padding: 20rpx;
  218. color: #fff;
  219. text-align: center;
  220. border-radius: 20rpx;
  221. }
  222. /deep/.u-radio-group {
  223. flex-direction: row-reverse;
  224. }
  225. .no-boder {
  226. border: 0;
  227. }
  228. .textarea {
  229. background: #F9F9FA;
  230. border: 1px solid #EEEEEE;
  231. }
  232. </style>