order_place.tpl 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958
  1. {include file="public/header-begin" /}
  2. <link rel="stylesheet" href="{$Think.config.base_url}/static/admin/css/style.min.css?v=4.0.0">
  3. <link rel="stylesheet" href="{$Think.config.base_url}/static/admin/css/plugins/steps/jquery.steps.css">
  4. <link rel="stylesheet" href="{$Think.config.base_url}/static/admin/css/plugins/chosen/chosen.css">
  5. <script src="{$Think.config.base_url}/static/common/js/vue.js"></script>
  6. {include file="public/header-end" /}
  7. <div id="vue" class="wrapper wrapper-content animated fadeInRight">
  8. <div class="row">
  9. <div class="col-sm-6">
  10. <div class="ibox float-e-margins">
  11. <div class="ibox-title">
  12. <h5>价格查询工具</h5>
  13. <div class="ibox-tools">
  14. <a class="collapse-link">
  15. <i class="fa fa-chevron-up"></i>
  16. </a>
  17. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  18. <i class="fa fa-wrench"></i>
  19. </a>
  20. <ul class="dropdown-menu dropdown-user">
  21. <li><a href="form_basic.html#">选项1</a>
  22. </li>
  23. <li><a href="form_basic.html#">选项2</a>
  24. </li>
  25. </ul>
  26. <a class="close-link">
  27. <i class="fa fa-times"></i>
  28. </a>
  29. </div>
  30. </div>
  31. <div class="ibox-content">
  32. <form method="get" class="form-horizontal">
  33. <div class="form-group">
  34. <label class="col-sm-2 control-label">产品类型</label>
  35. <div class="col-sm-2">
  36. <select v-model="queryPriceParam.ptype" class="form-control input-sm select-sm">
  37. <option value="1" selected>接机</option>
  38. <option value="2">送机</option>
  39. <option value="3">包车</option>
  40. </select>
  41. </div>
  42. <label class="col-sm-2 control-label">区域</label>
  43. <div class="col-sm-2">
  44. <select v-model="queryPriceParam.ktype" class="form-control input-sm select-sm">
  45. <option value="0" selected>市区</option>
  46. <option value="1">郊区</option>
  47. </select>
  48. </div>
  49. <label class="col-sm-2 control-label">是否跨城</label>
  50. <div class="col-sm-2">
  51. <select v-model="queryPriceParam.ctype" class="form-control input-sm select-sm">
  52. <option value="0" selected>否</option>
  53. <option value="1">是</option>
  54. </select>
  55. </div>
  56. </div>
  57. <div class="form-group">
  58. <label class="col-sm-2 control-label">用车时间</label>
  59. <div class="col-sm-10">
  60. <input v-model="queryPriceParam.usetime" type="text" class="form-control input-sm">
  61. </div>
  62. </div>
  63. <div class="hr-line-dashed"></div>
  64. <div class="form-group">
  65. <label class="col-sm-2 control-label">出发城市</label>
  66. <div class="col-sm-10">
  67. <div class="form-group input-group" style="width:100%; margin-left: 0; margin-bottom: 0">
  68. <input id="area" data-id="" placeholder="在这里输入城市关键词,比如曼谷" type="text" class="form-control input-sm" value="" v-el:area>
  69. <div class="input-group-btn">
  70. <button style="margin-bottom: 0" type="button" class="btn btn-sm btn-white dropdown-toggle" data-toggle="dropdown">
  71. <span class="caret"></span>
  72. </button>
  73. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  74. </ul>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="col-sm-2 control-label">出发地址</label>
  81. <div class="col-sm-10">
  82. <input v-model="queryPriceParam.route.from_name" type="text" class="form-control input-sm">
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <label class="col-sm-2 control-label">出发详细地址</label>
  87. <div class="col-sm-10">
  88. <input v-model="queryPriceParam.route.from_detail" type="text" class="form-control input-sm">
  89. </div>
  90. </div>
  91. <div class="hr-line-dashed"></div>
  92. <div class="form-group">
  93. <label class="col-sm-2 control-label">目的城市</label>
  94. <div class="col-sm-10">
  95. <div class="form-group input-group" style="width:100%; margin-left: 0; margin-bottom: 0">
  96. <input id="toCity" data-id="" placeholder="在这里输入城市关键词,比如曼谷" type="text" class="form-control input-sm" value="" v-el:toCity>
  97. <div class="input-group-btn">
  98. <button style="margin-bottom:0;" type="button" class="btn btn-sm btn-white dropdown-toggle" data-toggle="dropdown">
  99. <span class="caret"></span>
  100. </button>
  101. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  102. </ul>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="form-group">
  108. <label class="col-sm-2 control-label">目的地址</label>
  109. <div class="col-sm-10">
  110. <input v-model="queryPriceParam.route.to_name" type="text" class="form-control input-sm">
  111. </div>
  112. </div>
  113. <div class="form-group">
  114. <label class="col-sm-2 control-label">目的详细地址</label>
  115. <div class="col-sm-10">
  116. <input v-model="queryPriceParam.route.to_detail" type="text" class="form-control input-sm">
  117. </div>
  118. </div>
  119. <div class="hr-line-dashed"></div>
  120. <div class="form-group">
  121. <div class="col-sm-12 col-sm-offset-2">
  122. <button class="btn btn-primary" type="button" @click="queryPrice">查询价格</button>
  123. </div>
  124. </div>
  125. <div class="hr-line-dashed"></div>
  126. <div class="form-group">
  127. <label class="col-sm-2 control-label">行程统计</label>
  128. <div class="col-sm-10 control-label">
  129. 预计公里数/套餐公里数/超出公里数&nbsp;&nbsp;&nbsp;&nbsp; {{(queryPriceResult.distance.distance.value)/1000}} 公里 / {{(queryPriceResult.addroute.free_distance)/1000}} 公里 / {{(queryPriceResult.distance.distance.value - queryPriceResult.addroute.free_distance)/1000}} 公里
  130. </div>
  131. </div>
  132. <div class="form-group">
  133. <label class="col-sm-2 control-label">&nbsp;&nbsp;&nbsp;&nbsp;</label>
  134. <div class="col-sm-10 control-label">
  135. 预计时间/套餐时间/超出时间&nbsp;&nbsp;&nbsp;&nbsp; {{((queryPriceResult.distance.duration.value)/60).toFixed(2)}} 小时 / {{((queryPriceResult.addroute.free_time)/60).toFixed(2)}} 小时 / {{((queryPriceResult.distance.duration.value - queryPriceResult.addroute.free_time)/60).toFixed(2)}} 小时
  136. </div>
  137. </div>
  138. <div class="form-group">
  139. <label class="col-sm-2 control-label">&nbsp;&nbsp;&nbsp;&nbsp;</label>
  140. <div class="col-sm-10 control-label">
  141. 预计总金额/套餐金额/超出里程费用&nbsp;&nbsp;&nbsp;&nbsp; {{_amount}} 元 / {{((queryPriceResult.addroute.free_time)/60).toFixed(2)}} 元 / {{((queryPriceResult.distance.duration.value - queryPriceResult.addroute.free_time)/60).toFixed(2)}} 元
  142. </div>
  143. </div>
  144. </form>
  145. </div>
  146. </div>
  147. </div>
  148. <div class="col-sm-6">
  149. <div class="ibox float-e-margins">
  150. <div class="ibox-title">
  151. <h5>订购信息</h5>
  152. <div class="ibox-tools">
  153. <a class="collapse-link">
  154. <i class="fa fa-chevron-up"></i>
  155. </a>
  156. <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
  157. <i class="fa fa-wrench"></i>
  158. </a>
  159. <ul class="dropdown-menu dropdown-user">
  160. <li><a href="form_basic.html#">选项1</a>
  161. </li>
  162. <li><a href="form_basic.html#">选项2</a>
  163. </li>
  164. </ul>
  165. <a class="close-link">
  166. <i class="fa fa-times"></i>
  167. </a>
  168. </div>
  169. </div>
  170. <div class="ibox-content">
  171. <div class="form-horizontal">
  172. <div class="form-group">
  173. <label class="col-sm-2 control-label">产品类型</label>
  174. <div class="col-sm-4">
  175. <input type="text" class="form-control input-sm" readonly value="{{filterPtypename(queryPriceResult.ptype)}}">
  176. </div>
  177. <label class="col-sm-2 control-label">是否跨城</label>
  178. <div class="col-sm-4">
  179. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.ctype ? '是' : '否'}}">
  180. </div>
  181. </div>
  182. <div class="form-group">
  183. <label class="col-sm-2 control-label">用车时间</label>
  184. <div class="col-sm-10">
  185. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.usetime}}">
  186. </div>
  187. </div>
  188. <div class="hr-line-dashed"></div>
  189. <div class="form-group">
  190. <label class="col-sm-2 control-label">出发城市</label>
  191. <div class="col-sm-10">
  192. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.route.from_cityname}}">
  193. </div>
  194. </div>
  195. <div class="form-group">
  196. <label class="col-sm-2 control-label">出发地址</label>
  197. <div class="col-sm-10">
  198. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.route.from_name}}">
  199. </div>
  200. </div>
  201. <div class="form-group">
  202. <label class="col-sm-2 control-label">出发详细地址</label>
  203. <div class="col-sm-10">
  204. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.route.from_detail}}">
  205. </div>
  206. </div>
  207. <div class="hr-line-dashed"></div>
  208. <div class="form-group">
  209. <label class="col-sm-2 control-label">目的城市</label>
  210. <div class="col-sm-10">
  211. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.route.to_cityname}}">
  212. </div>
  213. </div>
  214. <div class="form-group">
  215. <label class="col-sm-2 control-label">目的地址</label>
  216. <div class="col-sm-10">
  217. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.route.to_name}}">
  218. </div>
  219. </div>
  220. <div class="form-group">
  221. <label class="col-sm-2 control-label">目的详细地址</label>
  222. <div class="col-sm-10">
  223. <input type="text" class="form-control input-sm" readonly value="{{queryPriceResult.route.to_detail}}">
  224. </div>
  225. </div>
  226. <div class="hr-line-dashed"></div>
  227. <div class="form-group">
  228. <label class="col-sm-2 control-label">车型列表</label>
  229. <div class="col-sm-9">
  230. <select id="carType" data-placeholder="选择车型" class="form-control input-sm select-sm chosen-select" style="height: 30px;width:100%;" v-model="carTypeid" v-el:carType>
  231. <option v-for="option in queryPriceResult.cartype_list" v-bind:value="option.cartypeid" hassubinfo="true">
  232. {{ option.name }} | 人数 {{ option.person }} | 行李 {{ option.luggage }} | 价格 {{ option.price }}
  233. </option>
  234. </select>
  235. </div>
  236. <label class="col-sm-1 control-label" @click="caradd()">[选择]</label>
  237. </div>
  238. <div class="form-group">
  239. <label class="col-sm-2 control-label">已选车型</label>
  240. <div class="col-sm-10" style="position: relative;">
  241. <input type="text" class="form-control input-sm" value="{{_cartypes}}" readonly>
  242. <div style="position: absolute; right: 20px;top: 5px;"><a href="javascript://" @click="clearCar()">[重选车型]</a></div>
  243. </div>
  244. </div>
  245. <div class="form-group" v-if="queryPriceResult.hasOwnProperty('addservice')">
  246. <label class="col-sm-2 control-label">{{placeOrderParam.addservice.child_chair1.name}}</label>
  247. <div class="col-sm-4">
  248. <input type="number" class="form-control input-sm" v-model="placeOrderParam.addservice.child_chair1.count">
  249. </div>
  250. <label class="col-sm-2 control-label">{{placeOrderParam.addservice.child_chair2.name}}</label>
  251. <div class="col-sm-4">
  252. <input type="number" class="form-control input-sm" v-model="placeOrderParam.addservice.child_chair2.count">
  253. </div>
  254. </div>
  255. <div class="hr-line-dashed"></div>
  256. <div class="form-group" v-if="queryPriceResult.hasOwnProperty('airport_list') && (queryPriceResult.ptype==1 || queryPriceResult.ptype==2)">
  257. <label class="col-sm-2 control-label">机场信息</label>
  258. <div class="col-sm-4">
  259. <select class="form-control input-sm select-sm" v-model="placeOrderParam.airport.airportid">
  260. <option v-for="option in queryPriceResult.airport_list" v-bind:value="option.airportid">
  261. {{ option.airportname }}
  262. </option>
  263. </select>
  264. </div>
  265. <label class="col-sm-2 control-label">举牌接机</label>
  266. <div class="col-sm-4">
  267. <input type="text" class="form-control input-sm" v-model="placeOrderParam.addservice.flight_pickup.title">
  268. </div>
  269. </div>
  270. <div class="hr-line-dashed"></div>
  271. <div class="form-group">
  272. <label class="col-sm-2 control-label">出行信息</label>
  273. <div class="col-sm-10">
  274. <table width="100%">
  275. <tr>
  276. <td><span>总人数</span></td>
  277. <td><input type="number" style="width:80px" class="form-control input-sm" v-model="placeOrderParam.person"></td>
  278. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  279. <td><span>儿童数</span></td>
  280. <td><input type="number" style="width:80px" class="form-control input-sm" value="{{placeOrderParam.child}}"></td>
  281. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  282. <td><span>行李数</span></td>
  283. <td><input type="number" style="width:80px" class="form-control input-sm" value="{{placeOrderParam.luggage}}"></td>
  284. <td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
  285. <td><span>用车天数</span></td>
  286. <td><input type="number" style="width:80px" class="form-control input-sm" value="{{placeOrderParam.cardays}}"></td>
  287. </tr>
  288. </table>
  289. </div>
  290. </div>
  291. <div class="hr-line-dashed"></div>
  292. <div class="form-group">
  293. <label class="col-sm-2 control-label">联系人姓名</label>
  294. <div class="col-sm-10">
  295. <input type="text" class="form-control input-sm" v-model="placeOrderParam.contact.truename">
  296. </div>
  297. </div>
  298. <div class="form-group">
  299. <label class="col-sm-2 control-label">联系人电话</label>
  300. <div class="col-sm-10">
  301. <input type="text" class="form-control input-sm" v-model="placeOrderParam.contact.phone">
  302. </div>
  303. </div>
  304. <div class="form-group">
  305. <label class="col-sm-2 control-label">备用电话</label>
  306. <div class="col-sm-10">
  307. <input type="text" class="form-control input-sm" v-model="placeOrderParam.contact.phone2">
  308. </div>
  309. </div>
  310. <div class="form-group">
  311. <label class="col-sm-2 control-label">微信</label>
  312. <div class="col-sm-10">
  313. <input type="text" class="form-control input-sm" v-model="placeOrderParam.contact.wechat">
  314. </div>
  315. </div>
  316. <div class="form-group">
  317. <label class="col-sm-2 control-label">联系人备注</label>
  318. <div class="col-sm-10">
  319. <textarea v-model="placeOrderParam.contact.remark" style="width: 100%; margin-top: 7px;height: 60px;border: 1px solid #e5e6e7;"></textarea>
  320. </div>
  321. </div>
  322. <div class="form-group">
  323. <div class="col-sm-12 col-sm-offset-2">
  324. <button class="btn btn-primary" type="button" @click="placeOrder">提交订单</button>
  325. </div>
  326. </div>
  327. </div>
  328. </div>
  329. </div>
  330. </div>
  331. </div>
  332. </div>
  333. <!--
  334. <div class="modal inmodal" id="modal-watch" tabindex="-1" role="dialog" aria-hidden="true">
  335. <div class="modal-dialog" style="width: 1000px">
  336. <div class="modal-content animated bounceInRight">
  337. <div class="modal-header">
  338. <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">关闭</span>
  339. </button>
  340. <h4 class="modal-title">选择车型(如果一辆车,则选中其中一辆即可)</h4>
  341. </div>
  342. <div class="modal-body">
  343. <table class="table table-hover">
  344. <thead>
  345. <tr>
  346. <th>ID</th>
  347. <th>用车时间</th>
  348. <th>用车天数</th>
  349. <th>总人数</th>
  350. <th>儿童数</th>
  351. <th>0~4岁童座</th>
  352. <th>5~7岁童座</th>
  353. <th>8-12童座</th>
  354. </tr>
  355. </thead>
  356. <tbody>
  357. <tr>
  358. <td valign="middle">
  359. <select id="carType" data-placeholder="选择车型" class="form-control input-sm select-sm chosen-select" style="height: 30px;width: 150px" v-model="carTypeid" v-el:carType>
  360. <option v-for="option in cartype" v-bind:value="option.id" hassubinfo="true">
  361. {{ option.name }}
  362. </option>
  363. </select>
  364. </td>
  365. <td><input v-model="addroute.usetime" type="datetime-local" class="form-control input-sm"></td>
  366. <td><input v-model="addroute.cardays" type="number" class="form-control input-sm"></td>
  367. <td><input v-model="addroute.person" type="number" class="form-control input-sm"></td>
  368. <td><input v-model="addroute.child" type="number" class="form-control input-sm"></td>
  369. <td><input v-model="addroute.usetime" type="number" class="form-control input-sm"></td>
  370. <td><input v-model="addroute.usetime" type="number" class="form-control input-sm"></td>
  371. <td><input v-model="addroute.usetime" type="number" class="form-control input-sm"></td>
  372. </tr>
  373. <tr v-if="cartype.length == 0">
  374. <td>该城市还没有配置车型信息</td>
  375. </tr>
  376. </tbody>
  377. </table>
  378. <table class="table table-hover">
  379. <thead>
  380. <tr>
  381. <th>ID</th>
  382. <th>用车时间</th>
  383. <th>用车天数</th>
  384. <th>乘车人数</th>
  385. </tr>
  386. </thead>
  387. <tbody>
  388. <tr v-for="routeitem of item.addroute">
  389. <td valign="middle">
  390. {{ routeitem.cartypeid }}
  391. </td>
  392. <td>
  393. {{ routeitem.cartype }}
  394. </td>
  395. <td>
  396. {{ routeitem.cardays }}
  397. </td>
  398. <td>
  399. {{ routeitem.person }}
  400. </td>
  401. </tr>
  402. </tbody>
  403. </table>
  404. </div>
  405. <div class="modal-footer">
  406. <button type="button" class="btn btn-white" data-dismiss="modal">关闭</button>
  407. </div>
  408. </div>
  409. </div>
  410. </div>
  411. -->
  412. {include file="public/footer-js" /}
  413. <script src="{$Think.config.base_url}/static/admin/js/plugins/suggest/bootstrap-suggest.min.js"></script>
  414. <script>
  415. new Vue({
  416. el: 'body',
  417. data: {
  418. queryPriceParam:{
  419. route:{
  420. from_cityid:0,
  421. from_name: '素万那普国际机场',
  422. from_detail: '素万那普国际机场',
  423. to_cityid:0,
  424. to_name: '白宫大酒店',
  425. to_detail: 'Phetchaburi 15 Alley, Thanon Phaya Thai, Ratchathewi, Bangkok',
  426. }
  427. },
  428. queryPriceResult:{
  429. //usetime:'123123123',
  430. route:{},
  431. addroute:{}
  432. },
  433. placeOrderParam:{
  434. usetime:'',
  435. ptype:1,
  436. ctype:0,
  437. ktype:0,
  438. person:0,
  439. child:0,
  440. luggage:0,
  441. cardays:1,
  442. amount_original:0,
  443. amount:0,
  444. contact:{},
  445. cartype_list:[],
  446. route:{},
  447. addservice:{
  448. child_chair1:{
  449. keyword:"",
  450. name:"",
  451. count:0,
  452. price:0
  453. },
  454. child_chair2:{
  455. keyword:"",
  456. name:"",
  457. count:0,
  458. price:0
  459. },
  460. flight_pickup:{
  461. keyword:"",
  462. name:"",
  463. title:'',
  464. price:0
  465. }
  466. },
  467. airport:{}
  468. }
  469. },
  470. computed : {
  471. _airportItem: function() {
  472. for (var item of this.queryPirceResult.airport_list) {
  473. if(item.airportid == this.placeOrder.airportid) {
  474. return item;
  475. }
  476. }
  477. return null;
  478. },
  479. _cartypes: function () {
  480. var rescars = '';
  481. for(var item of this.placeOrderParam.cartype_list) {
  482. rescars = rescars + item.name + '、'
  483. }
  484. return rescars.substring(0,rescars.length-1);
  485. },
  486. _amount_original: function () {
  487. var amount = 0;
  488. return amount;
  489. },
  490. _amount: function () {
  491. var amount = 0;
  492. //计算车型价格
  493. for(var item of this.placeOrderParam.cartype_list) {
  494. amount += item.price * 1
  495. }
  496. console.log(this.placeOrderParam.cartype_list);
  497. //计算夜间服务费
  498. //if(this.queryPriceResult.addroute.hasOwnProperty('night')) {
  499. amount += this.queryPriceResult.addroute.night * 1;
  500. //}
  501. //附加服务费
  502. amount += this._amountAddservice * 1;
  503. return amount;
  504. },
  505. _amountAddservice: function () {
  506. var amount = 0;
  507. if(this.queryPriceResult.hasOwnProperty('addservice')) {
  508. if(this.queryPriceResult.addservice.hasOwnProperty('child_chair1')) {
  509. var chair = this.queryPriceResult.addservice.child_chair1;
  510. for(var item of chair) {
  511. amount += this.queryPriceResult.addservice.child_chair1.price * this.placeOrderParam.addservice.child_chair1.count * 1;
  512. }
  513. console.log(amount);
  514. }
  515. return amount;
  516. }
  517. return 0;
  518. }
  519. },
  520. methods: {
  521. queryPrice: function () {
  522. var that = this;
  523. var param = {};
  524. param.ptype = this.queryPriceParam.ptype;
  525. param.ctype = this.queryPriceParam.ctype;
  526. param.ktype = this.queryPriceParam.ktype;
  527. param.route = {};
  528. param.route.from_cityid = this.queryPriceParam.route.from_cityid;
  529. param.route.from_cityname = this.queryPriceParam.route.from_cityname;
  530. param.route.from_name = this.queryPriceParam.route.from_name;
  531. param.route.from_detail = this.queryPriceParam.route.from_detail;
  532. param.route.to_cityid = this.queryPriceParam.route.to_cityid;
  533. param.route.to_cityname = this.queryPriceParam.route.to_cityname;
  534. param.route.to_name = this.queryPriceParam.route.to_name;
  535. param.route.to_detail = this.queryPriceParam.route.to_detail;
  536. $.ajax({
  537. url: '{:url('city/queryPrice')}',
  538. data:{data:param},
  539. type: 'post',
  540. dataType: 'json',
  541. }).done(function (data) {
  542. if (data.code == 1) {
  543. //保存原始返回数据
  544. that.queryPriceResult = data.content;
  545. //this.placeOrderParam.addservice
  546. if(that.queryPriceResult.hasOwnProperty('addservice')) {
  547. if(that.queryPriceResult.addservice.hasOwnProperty('child_chair1')) {
  548. that.placeOrderParam.addservice.child_chair1.keyword = that.queryPriceResult.addservice.child_chair1.keyword;
  549. that.placeOrderParam.addservice.child_chair1.name = that.queryPriceResult.addservice.child_chair1.name;
  550. that.placeOrderParam.addservice.child_chair1.count = 0;
  551. that.placeOrderParam.addservice.child_chair1.price = 0;
  552. }
  553. if(that.queryPriceResult.addservice.hasOwnProperty('child_chair2')) {
  554. that.placeOrderParam.addservice.child_chair2.keyword = that.queryPriceResult.addservice.child_chair2.keyword;
  555. that.placeOrderParam.addservice.child_chair2.name = that.queryPriceResult.addservice.child_chair2.name;
  556. that.placeOrderParam.addservice.child_chair2.count = 0;
  557. that.placeOrderParam.addservice.child_chair2.price = 0;
  558. }
  559. if(that.queryPriceResult.addservice.hasOwnProperty('flight_pickup')) {
  560. that.placeOrderParam.addservice.flight_pickup.keyword = that.queryPriceResult.addservice.flight_pickup.keyword;
  561. that.placeOrderParam.addservice.flight_pickup.name = that.queryPriceResult.addservice.flight_pickup.name;
  562. that.placeOrderParam.addservice.flight_pickup.title = '';
  563. that.placeOrderParam.addservice.flight_pickup.price = 0;
  564. }
  565. }
  566. setTimeout(function () {
  567. that.carSelect();
  568. }, 300);
  569. }
  570. else {
  571. swal(data.msg);
  572. req2.reject();//非常好,不再走下一个then
  573. }
  574. });
  575. },
  576. placeOrder: function () {
  577. this.placeOrderParam.usetime = this.queryPriceResult.usetime;
  578. this.placeOrderParam.ptype = this.queryPriceResult.ptype;
  579. this.placeOrderParam.ctype = this.queryPriceResult.ctype;
  580. this.placeOrderParam.ktype = this.queryPriceResult.ktype;
  581. //this.placeOrderParam.cardays
  582. //this.placeOrderParam.person
  583. //this.placeOrderParam.child
  584. //this.placeOrderParam.luggage
  585. //this.placeOrderParam.amount_original
  586. //this.placeOrderParam.amount
  587. //this.placeOrderParam.promotionid
  588. this.placeOrderParam.route = this.queryPriceResult.route;
  589. //this.placeOrderParam.cartype_list
  590. for(var item of this.placeOrderParam.cartype_list) {
  591. console.log(item);
  592. }
  593. var param = {};
  594. param.ptype = this.queryPriceResult.ptype;
  595. param.ctype = this.queryPriceResult.ctype;
  596. param.route = this.queryPriceResult.route;
  597. //param.route
  598. param.route.from_cityid = this.queryPriceParam.route.from_cityid;
  599. param.route.from_cityname = this.queryPriceParam.route.from_cityname;
  600. param.route.from_name = this.queryPriceParam.route.from_name;
  601. param.route.from_detail = this.queryPriceParam.route.from_detail;
  602. param.route.to_cityid = this.queryPriceParam.route.to_cityid;
  603. param.route.to_cityname = this.queryPriceParam.route.to_cityname;
  604. param.route.to_name = this.queryPriceParam.route.to_name;
  605. param.route.to_detail = this.queryPriceParam.route.to_detail;
  606. $.ajax({
  607. url: '{:url('city/placeOrder')}',
  608. data:{data:param},
  609. type: 'post',
  610. dataType: 'json',
  611. }).done(function (data) {
  612. if (data.code == 1) {
  613. this.queryPriceResult = data.content;
  614. }
  615. else {
  616. swal(data.msg);
  617. req2.reject();//非常好,不再走下一个then
  618. }
  619. });
  620. },
  621. changeStep: function(step) {
  622. if(step > 0 && this.step == 4) {
  623. return;
  624. }
  625. if(step < 0 && this.step == 1) {
  626. return;
  627. }
  628. if(step > 0 && this.step == 1) {
  629. this.getDistancematrix();
  630. }
  631. this.step += step;
  632. },
  633. thisStep: function (step) {
  634. this.step = step;
  635. },
  636. getDistancematrix: function() {
  637. var that = this;
  638. var param;
  639. //接机
  640. if(this.item.ptype == 1) {
  641. param = {
  642. from_name: this._airportItem.name_cn,//起始地址
  643. from_city: this.city.name_cn,//起始城市名称
  644. to_name: this.item.address.to_name,//到达地址
  645. to_city: this.city.name_cn,//到达城市名称
  646. to_detail: this.item.address.to_detail,//到达详细地址
  647. };
  648. }
  649. //送机
  650. else if(this.item.ptype == 2){
  651. param = {
  652. from_name: this.item.to_name,//起始地址
  653. from_city: this._airportItem.name_cn,//起始城市名称
  654. to_name: this.item.to_name,//到达地址
  655. to_city: this.city.name_cn,//到达城市名称
  656. };
  657. }
  658. $.ajax({
  659. url: '{:url('map/getDistancematrix')}',
  660. data: param,
  661. type: 'post',
  662. dataType: 'json',
  663. success: function (data) {
  664. if (data.code == 1) {
  665. that.distancematrix = data.content;
  666. }
  667. else {
  668. swal("机场" + data.msg);
  669. }
  670. }
  671. });
  672. },
  673. getPartnerList:function () {
  674. var that = this;
  675. $.ajax({
  676. url: '{:url('system/getPartnerList')}',
  677. data: [],
  678. type: 'post',
  679. dataType: 'json',
  680. success: function (data) {
  681. if (data.code == 1) {
  682. that.partnerList = data.content;
  683. }
  684. else {
  685. swal(data.msg);
  686. }
  687. }
  688. });
  689. },
  690. amountCopy: function () {
  691. this.item.amount = this._amount;
  692. },
  693. addOrder: function () {
  694. //接机
  695. if(this.item.ptype == 1) {
  696. this.item.address.from_name = this._airportItem.name_cn;//起始地址
  697. this.item.address.from_detail = this._airportItem.name_cn;//起始地址
  698. this.item.address.from_cid = this.city.cityid;//起始城市名称
  699. this.item.address.from_city = this.city.name_cn;//起始城市名称
  700. this.item.address.from_x = this._airportItem.x;//经度
  701. this.item.address.from_y = this._airportItem.y;//维度
  702. this.item.address.to_name = this.item.to_name;//到达地址
  703. this.item.address.to_detail = this.item.to_detail;//到达详细地址
  704. this.item.address.to_cid = this.city.cityid;//到达城市名称
  705. this.item.address.to_city = this.city.name_cn;//到达城市名称
  706. this.item.address.to_x = 0;//经度
  707. this.item.address.to_y = 0;//维度
  708. }
  709. //送机
  710. else if(this.item.ptype == 2) {
  711. }
  712. this.item.addroute.cartypeid = this._carTypeItem.id;
  713. this.item.addroute.cartype = this._carTypeItem.name;
  714. this.item.addroute.price = this._carTypeItem.price;
  715. this.item.addroute.carcount = this._carTypeItem.carcount;
  716. this.item.addroute.over_time_price = this._over_time_price;
  717. this.item.addroute.over_distance_price = this._over_distance_price;
  718. this.item.addroute.estimated_time = this.distancematrix.duration.value;
  719. this.item.addroute.estimated_distance = this.distancematrix.distance.value;
  720. this.item.addroute.over_time = (this.distancematrix.duration.value - this.item.addroute.free_time) * 1 < 0 ? 0 : (this.distancematrix.duration.value - this.item.addroute.free_time) * 1;
  721. this.item.addroute.over_distance = (this.distancematrix.distance.value - this.item.addroute.free_distance ) * 1 < 0 ? 0 : (this.distancematrix.distance.value - this.item.addroute.free_distance) * 1;
  722. var that = this;
  723. $.ajax({
  724. url: '{:url('order/addOrder')}',
  725. data: this.item,
  726. type: 'post',
  727. dataType: 'json',
  728. success: function (data) {
  729. if (data.code == 1) {
  730. swal(data.msg);
  731. }
  732. else {
  733. swal(data.msg);
  734. }
  735. }
  736. });
  737. },
  738. caradd:function () {
  739. var cartypeid = 0;
  740. $(this.$els.cartype).find("option:selected").each(function(){
  741. cartypeid = $(this).val();
  742. }); //这里得到的就是 });
  743. for (var item of this.queryPriceResult.cartype_list) {
  744. if(item.cartypeid == cartypeid) {
  745. this.placeOrderParam.cartype_list.push(item);
  746. return;
  747. }
  748. }
  749. return {
  750. price :0
  751. };
  752. },
  753. clearCar: function () {
  754. this.placeOrderParam.cartype_list = [];
  755. },
  756. carSelect: function () {
  757. var that = this;
  758. $("#carType").chosen({
  759. no_results_text: "没有找到!",
  760. allow_single_deselect: true,
  761. display_disabled_options: false
  762. }).change(function(){
  763. that.carTypeid
  764. });;
  765. $("#carType").trigger("liszt:updated");
  766. //$(".dept-select").chosen().
  767. },
  768. showSelect: function () {
  769. $(this.$els.cartype).find("option:selected").each(function(){
  770. alert($(this).val());
  771. }); //这里得到的就是 });
  772. },
  773. filterPtypename:function (ptype) {
  774. if(ptype == 1) {
  775. return '接机';
  776. }
  777. else if(ptype == 2) {
  778. return '送机';
  779. }
  780. else if(ptype == 3) {
  781. return '包车';
  782. }
  783. }
  784. },
  785. ready : function () {
  786. var that = this;
  787. //this.getPartnerList();
  788. $("#area").bsSuggest({
  789. indexId: 0,
  790. indexKey: 1,
  791. getDataMethod: "url",
  792. effectiveFieldsAlias: {
  793. cityid: "编号",
  794. name_cn: "城市",
  795. name_la: "地区",
  796. },
  797. showHeader: true,
  798. data: {
  799. value:[]
  800. },
  801. url: "{:url('city/getCityListByKeyword')}" + "/?keyword=",
  802. processData: function(json) {
  803. var i, len, data = {
  804. value: []
  805. };
  806. if (json.code!=1) {
  807. return;
  808. }
  809. len = json.content.length;
  810. for (i = 0; i < len; i++) {
  811. data.value.push({
  812. "cityid": json.content[i]['cityid'],
  813. "name_cn": json.content[i]['name_cn'],
  814. "name_la": json.content[i]['name_la'],
  815. })
  816. }
  817. return data;
  818. }
  819. }).on('onSetSelectValue', function (e, keyword) {
  820. that.queryPriceParam.route.from_cityid = keyword.id;
  821. that.queryPriceParam.route.from_cityname = keyword.key;
  822. });
  823. $("#toCity").bsSuggest({
  824. indexId: 0,
  825. indexKey: 1,
  826. getDataMethod: "url",
  827. effectiveFieldsAlias: {
  828. cityid: "编号",
  829. name_cn: "城市",
  830. name_la: "地区",
  831. },
  832. showHeader: true,
  833. data: {
  834. value:[]
  835. },
  836. url: "{:url('city/getCityListByKeyword')}" + "/?keyword=",
  837. processData: function(json) {
  838. var i, len, data = {
  839. value: []
  840. };
  841. if (json.code!=1) {
  842. return;
  843. }
  844. len = json.content.length;
  845. for (i = 0; i < len; i++) {
  846. data.value.push({
  847. "cityid": json.content[i]['cityid'],
  848. "name_cn": json.content[i]['name_cn'],
  849. "name_la": json.content[i]['name_la'],
  850. })
  851. }
  852. return data;
  853. }
  854. }).on('onSetSelectValue', function (e, keyword) {
  855. that.queryPriceParam.route.to_cityid = keyword.id;
  856. that.queryPriceParam.route.to_cityname = keyword.key;
  857. });
  858. },
  859. })
  860. </script>
  861. <style>
  862. .chosen-container-single .chosen-single { padding-top: 3px;padding-bottom: 0;padding-left:10px;}
  863. .chosen-container-single .chosen-single div b { background-position: 0px 4px; }
  864. .chosen-container-active.chosen-with-drop .chosen-single div b { background-position-y:4px; }
  865. .chosen-container-multi .chosen-choices {
  866. padding: 0;
  867. }
  868. .chosen-container-active .chosen-choices {
  869. border: 1px solid #ccc;
  870. box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
  871. }
  872. .chosen-container-multi .chosen-results {
  873. padding:4px;
  874. }
  875. .chosen-container .chosen-results li {
  876. }
  877. </style>
  878. <script src="{$Think.config.base_url}/static/admin/js/plugins/chosen/chosen.jquery.js"></script>
  879. <script>
  880. </script>
  881. {include file="public/footer" /}