short_track_addition.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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.titleBtn == "开始轨迹") {
  68. var that = this
  69. uni.showModal({
  70. content: "确定开始轨迹?",
  71. showCancel: true,
  72. confirmText: '确定',
  73. success: function(res) {
  74. if (res.confirm) {
  75. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  76. that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
  77. that.detailData.driverName = uni.getStorageSync('userInfo').userName
  78. that.detailData.trackFlag = "0"
  79. that.detailData.fillingNo = "202207040004"
  80. that.detailData.originProvince = "黑龙江省"
  81. that.detailData.originCity = "齐齐哈尔市"
  82. that.detailData.originArea = "克东县"
  83. that.detailData.sendWarehouse = "克东千丰库"
  84. that.detailData.originLongitude = "123.188"
  85. that.detailData.originLatitude = "41.737"
  86. that.$api.doRequest('post', '/shortFillingInfo/api/addShortFilling',
  87. that.detailData
  88. )
  89. .then(res => {
  90. that.id = res.data.data
  91. if (res.data.code == 200) {
  92. that.$api.msg('提交成功')
  93. that.titleBtn = "结束轨迹"
  94. } else {
  95. that.$api.msg('提交失败')
  96. }
  97. })
  98. }
  99. }
  100. })
  101. } else if (this.titleBtn == "结束轨迹") {
  102. var that = this
  103. uni.showModal({
  104. content: "确定结束轨迹?",
  105. showCancel: true,
  106. confirmText: '确定',
  107. success: function(res) {
  108. if (res.confirm) {
  109. that.detailData.compId = uni.getStorageSync('pcUserInfo').compId
  110. that.detailData.commonId = uni.getStorageSync('pcUserInfo').userId
  111. that.detailData.driverName = uni.getStorageSync('userInfo').userName
  112. that.detailData.trackFlag = "1"
  113. that.detailData.destinationProvince = "辽宁省"
  114. that.detailData.receiveWarehouse = "鲅鱼圈红运库"
  115. that.detailData.carNo
  116. that.detailData.mileage = "15"
  117. that.detailData.destinationLongitude = "118.291"
  118. that.detailData.destinationLatitude = "33.942"
  119. that.$api.doRequest('post', '/shortFillingInfo/api/addShortFilling',
  120. that.detailData
  121. )
  122. .then(res => {
  123. if (res.data.code == 200) {
  124. that.$api.msg('提交成功')
  125. uni.navigateTo({
  126. url: '/pages/shortDistance/short_distance_record'
  127. })
  128. } else {
  129. that.$api.msg('提交失败')
  130. }
  131. })
  132. }
  133. }
  134. })
  135. }
  136. },
  137. }
  138. }
  139. </script>
  140. <style lang='scss' scoped>
  141. page {
  142. background: #F5F6FA;
  143. }
  144. .title_b {
  145. margin: 20rpx 20rpx 0rpx 20rpx;
  146. padding: 20rpx 10rpx 20rpx 10rpx;
  147. font-size: 18px;
  148. font-weight: 550;
  149. }
  150. .c-row {
  151. display: -webkit-box;
  152. display: -webkit-flex;
  153. display: flex;
  154. -webkit-box-align: center;
  155. -webkit-align-items: center;
  156. align-items: center;
  157. padding: 20rpx 30rpx;
  158. }
  159. .con-list {
  160. -webkit-box-flex: 1;
  161. -webkit-flex: 1;
  162. flex: 1;
  163. display: -webkit-box;
  164. display: -webkit-flex;
  165. display: flex;
  166. -webkit-box-orient: vertical;
  167. -webkit-box-direction: normal;
  168. -webkit-flex-direction: column;
  169. flex-direction: column;
  170. color: #303133;
  171. line-height: 40rpx;
  172. text-align: right;
  173. padding-right: 20rpx;
  174. }
  175. .wrap {
  176. font-size: 14px;
  177. background: #fff;
  178. margin: 10px;
  179. border-radius: 15px 10px;
  180. input {
  181. font-size: 14px;
  182. }
  183. >.title {
  184. padding: 10px 16px;
  185. }
  186. }
  187. .button {
  188. background: #22C572;
  189. width: 90%;
  190. margin: 250px auto;
  191. padding: 10px;
  192. color: #fff;
  193. text-align: center;
  194. border-radius: 30px;
  195. }
  196. .button1 {
  197. background: #ff0000;
  198. width: 90%;
  199. margin: 250px auto;
  200. padding: 10px;
  201. color: #fff;
  202. text-align: center;
  203. border-radius: 30px;
  204. }
  205. .buns_item {
  206. display: flex;
  207. padding: 80rpx 0 50rpx 0;
  208. justify-content: space-around;
  209. }
  210. .but_css {
  211. background: #22C572;
  212. width: 40%;
  213. padding: 20rpx;
  214. color: #fff;
  215. text-align: center;
  216. border-radius: 20rpx;
  217. }
  218. /deep/.u-radio-group {
  219. flex-direction: row-reverse;
  220. }
  221. .no-boder {
  222. border: 0;
  223. }
  224. .textarea {
  225. background: #F9F9FA;
  226. border: 1px solid #EEEEEE;
  227. }
  228. </style>