track_addition.vue 5.8 KB

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