混凝土运输管理微信小程序、替班
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

271 lines
7.8 KiB

1 week ago
  1. <template>
  2. <view class="content">
  3. <view class="mt20">
  4. <view class="re-card-p32">
  5. <view class="flex-sb">
  6. <view class="re-from-label">写在前面</view>
  7. </view>
  8. <view class="re-card-context">
  9. 感谢您在替班平台发布订单如果您在订单环节中有什么疑问可以通过<span>小程序我的>联系客服</span>快捷联系/留言平台服务人员我们将7*24为您服务
  10. </view>
  11. </view>
  12. <view class="re-card-p32">
  13. <view class="re-from-line" @click="show=true">
  14. <view class="re-from-label">施工设备</view>
  15. <view class="b-relative">
  16. <input v-model="form.carId" disabled="true" maxlength="8" class="re-from-input" placeholder="请选择施工设备" />
  17. <image class="re-from-icon" src="/static/icons/icon06.png"></image>
  18. </view>
  19. </view>
  20. <view class="re-from-line">
  21. <view class="re-from-label">计划数量</view>
  22. <view class="b-relative">
  23. <input v-model="form.mi" type="number" maxlength="8" class="re-from-input" placeholder="请填写计划数量" />
  24. <image class="re-from-icon" src="/static/icons/icon07.png"></image>
  25. </view>
  26. </view>
  27. <view class="re-card-context" style="margin-top: -20rpx;">
  28. <span>*注意</span>
  29. 保障金将按照所选车辆(车段)计划数量按照
  30. 计算方式<span>n*单价泵车填写的计划数量是方量搅拌车填写的计划数量是指趟数向上取整最低支付1000元</span>
  31. 进行收取
  32. </view>
  33. <view class="h32"></view>
  34. <view class="re-from-line">
  35. <view class="re-from-label">合同属性</view>
  36. <view class="b-relative">
  37. <radio-group @change="changeType">
  38. <radio class="re-radio re-width2" value="1" :checked="+form.type===1">合同单</radio>
  39. <radio class="re-radio re-width2" value="2" :checked="+form.type===2">现金单</radio>
  40. </radio-group>
  41. </view>
  42. </view>
  43. <view class="re-from-line" @click="openSelect">
  44. <view class="re-from-label">到场地点</view>
  45. <view class="b-relative">
  46. <input class="re-from-input" v-model="form.address" disabled="true"
  47. placeholder="选择施工到场地点" />
  48. <image class="re-from-icon" src="/static/icons/icon05.png"/>
  49. </view>
  50. </view>
  51. <select-time @selected="changeInTime"></select-time>
  52. <view class="re-from-line">
  53. <view class="re-from-label">到场时间</view>
  54. <view class="b-relative">
  55. <select-time @selected="changeInTime">
  56. <input v-model="form.inTime" disabled="true" class="re-from-input" placeholder="选择施工进场时间" />
  57. </select-time>
  58. <!-- <picker mode="date" start="2024-03-01" @change="changeInTime">
  59. <input v-model="form.inTime" disabled="true" class="re-from-input" placeholder="选择施工进场时间" />
  60. </picker> -->
  61. <image class="re-from-icon" src="/static/icons/icon08.png"></image>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="re-card-p32">
  66. <view class="re-from-label">您可以在这里进行补充说明选填</view>
  67. <textarea v-model="form.remark" class="re-card-textarea inpit" placeholder="请在此处留言或者备注其他特殊情况司机接单前可以看到订单留言">
  68. </textarea>
  69. </view>
  70. <view class="re-end-pand">
  71. <button @click="submit">提交审核</button>
  72. </view>
  73. </view>
  74. <select-car :show="show" @success="addCar" @close="show=false"></select-car>
  75. </view>
  76. </template>
  77. <script>
  78. import SelectCar from '/components/select-car.vue'
  79. import SelectTime from '/components/select-datetime.vue'
  80. export default {
  81. components: {
  82. SelectCar
  83. , SelectTime
  84. },
  85. data() {
  86. return {
  87. show: false,
  88. form: {
  89. type: "1",
  90. carId: "",
  91. mi: "",
  92. inTime: "",
  93. remark: "",
  94. address: "",
  95. addressSimple: "",
  96. latitude: "",
  97. longitude: "",
  98. carNo: "",
  99. carMi: "",
  100. carImage: ""
  101. },
  102. addr: {
  103. name:"",
  104. address: "",
  105. latitude: "",
  106. longitude: ""
  107. }
  108. }
  109. },
  110. onLoad() {
  111. },
  112. methods: {
  113. openSelect(){
  114. uni.chooseLocation({
  115. success:(res)=> {
  116. console.log(res);
  117. this.addr.name = res.name
  118. this.addr.address = res.address
  119. this.addr.latitude = res.latitude
  120. this.addr.longitude = res.longitude
  121. this.form.address = res.address
  122. this.form.addressSimple = res.name
  123. this.form.latitude = res.latitude
  124. this.form.longitude = res.longitude
  125. }
  126. })
  127. },
  128. changeType(event){
  129. this.form.type = event.detail.value
  130. },
  131. changeInTime(event){
  132. console.log(event);
  133. this.form.inTime = event
  134. },
  135. addCar(car){
  136. console.log(car);
  137. this.form.carId = car.id;
  138. this.form.carImage = car.carimage;
  139. this.form.carMi = car.mi;
  140. this.form.carNo = car.carno || "湘A·--";
  141. },
  142. submit(){
  143. if(!this.form.mi){
  144. uni.showToast({ icon: "none", title: "请填写计划数量" })
  145. return
  146. }
  147. if(!this.form.carId){
  148. uni.showToast({ icon: "none", title: "请选择施工设备" })
  149. return
  150. }
  151. if(!this.form.type){
  152. uni.showToast({ icon: "none", title: "请勾选合同属性" })
  153. return
  154. }
  155. if(!this.form.address){
  156. uni.showToast({ icon: "none", title: "请选择施工到场地点" })
  157. return
  158. }
  159. if(!this.form.inTime){
  160. uni.showToast({ icon: "none", title: "请选择施工到场时间" })
  161. return
  162. }
  163. this.doSubmit()
  164. },
  165. doSubmit(){
  166. uni.showLoading({})
  167. this.form.id = this.$utils.generateUUID()
  168. this.form.status = -1
  169. this.form.orderNo = "QJR" + new Date().getTime()
  170. this.form.area = uni.getStorageSync("area")
  171. this.form.enter_id = uni.getStorageSync("enter_id")
  172. this.$httpPost("/api/order/push", this.form, (res) => {
  173. console.log('[/order/push]', res);
  174. if(res.data || res.data == 1){
  175. setTimeout(()=>{
  176. uni.hideLoading({})
  177. uni.showToast({ icon: "none", title: "数据已提交" })
  178. this.doPrice()
  179. }, 1500)
  180. }
  181. })
  182. },
  183. doPrice(){
  184. this.$httpGet("/api/mi/byName", {mi: this.form.carMi}, (res) => {
  185. if(res.data && res.data.price){
  186. let price = Math.ceil(this.form.mi*res.data.price*100)
  187. if(price<100000) price = 100000;
  188. console.log("计价结果", price);
  189. this.doPay(price)
  190. } else {
  191. this.doPay(Math.ceil(this.form.mi*2))
  192. }
  193. })
  194. },
  195. doPay(price){
  196. if (!uni.getStorageSync("openid")){
  197. uni.showToast({ icon: "none", title: "拉起支付失败OPENID丢失" })
  198. return
  199. }
  200. if (!this.form.orderNo){
  201. this.form.orderNo = "qjr" + Date.now()
  202. }
  203. let data = {
  204. openId: uni.getStorageSync("openid"),
  205. outTradeNo: this.form.orderNo,
  206. body: "bzj",
  207. totalFee: price,
  208. timestamp: ""
  209. }
  210. const ecsdoasdasdasdasdasdasdasdid = this.form.id
  211. this.$httpGet("/wxpay/unifyOrderV3", data, (res) => {
  212. console.log(res);
  213. let resquest = {
  214. provider: 'wxpay',
  215. success: (res)=>{
  216. console.log(res);
  217. this.$httpGet("/api/order/payed", {id: ecsdoasdasdasdasdasdasdasdid}, (res) => {
  218. uni.showToast({ icon: "none", title: '支付成功' })
  219. setTimeout(() => {
  220. uni.switchTab({
  221. url:"/pages/index/order"
  222. })
  223. }, 1000)
  224. })
  225. },
  226. fail:(err)=>{
  227. console.log(err);
  228. uni.showToast({ icon:"none", title: '支付失败,请重试' })
  229. },
  230. }
  231. let a = Object.assign(resquest, res)
  232. a.package = a.packageValue
  233. console.log(a)
  234. uni.requestPayment(a)
  235. })
  236. }
  237. }
  238. }
  239. </script>
  240. <style>
  241. page {
  242. background-color: #F5F5F5;
  243. }
  244. /deep/ uni-radio .uni-radio-input{
  245. background-color: #F40000 !important;
  246. border-color: #F40000 !important;
  247. }
  248. /deep/ uni-radio .uni-radio-input:empty{
  249. background-color: #ffffff !important;
  250. border-color: #888888 !important;
  251. }
  252. </style>