Няма описание

orderedit.blade.php 37KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. @extends('admin/master')
  2. @section('content')
  3. <body>
  4. @if(count($errors) > 0)
  5. <div class="Huialert Huialert-info" id="error">
  6. @foreach($errors->all() as $error)
  7. <li>{{$error}}</li>
  8. @endforeach
  9. </div>
  10. @endif
  11. <style type="text/css">
  12. #good_sku{
  13. position: absolute;
  14. z-index: 9;
  15. background: #ffffff;
  16. box-shadow: 1px 1px 1px 1px #ccc;
  17. width: calc(100% - 30px);
  18. }
  19. #good_sku li{
  20. font-size: 12px;
  21. line-height: 24px;
  22. cursor: pointer;
  23. padding: 5px 10px;
  24. }
  25. #good_sku li:hover{
  26. background: #eaeaea;
  27. }
  28. </style>
  29. <div class="page-container">
  30. <form id='order-form' action="/admin/order/update" method="post" class="form form-horizontal" enctype="multipart/form-data" onkeypress="return event.keyCode != 13;">
  31. <input type="hidden" name="_token" value="{{ csrf_token() }}" />
  32. <input type='hidden' name='str_query' value="{{$str_query}}"/>
  33. <input type='hidden' name='last_url' value="{{$last_url}}"/>
  34. @if($order)
  35. <input type="hidden" name="id" value="{{$order['id']}}" />
  36. <div class="row cl">
  37. <label class="form-label col-xs-4 col-sm-2">
  38. <font color='red'>* </font>买家姓名:</label>
  39. <div class="formControls col-xs-6 col-sm-6">
  40. <input type="text" class="input-text" value="{{$order['customerName']}}" placeholder="请输入名称" name="customerName">
  41. </div>
  42. </div>
  43. <div class="row cl">
  44. <label class="form-label col-xs-4 col-sm-2">
  45. <font color='red'>* </font>买家手机号:</label>
  46. <div class="formControls col-xs-6 col-sm-6">
  47. {{$order['buyer_phone']}}
  48. <input type="hidden" class="input-text" value="{{$order['buyer_phone']}}" placeholder="" name="buyer_phone">
  49. </div>
  50. </div>
  51. @if($order['status'] < 2)
  52. <div id='use_coupon_div' class="row cl" @if($order['use_coupon'] !='1' && $cust_info['coupons'] != '1') style="display: none" @endif>
  53. <label class="form-label col-xs-4 col-sm-2">
  54. <font color='red'>* </font>是否使用优惠券:</label>
  55. <div class="formControls col-xs-6 col-sm-6">
  56. <input type="radio" name="use_coupon" value="0" @if($order['use_coupon']=='0') checked @endif>
  57. <label for="status-0" style="margin-right: 27px;">否</label>
  58. <input type="radio" name="use_coupon" value="1" @if($order['use_coupon']=='1') checked @endif>
  59. <label for="status-1">是</label>
  60. </div>
  61. </div>
  62. @else
  63. <div id='use_coupon_div' class="row cl" @if($order['use_coupon'] !='1' && $cust_info['coupons'] != '1') style="display: none" @endif>
  64. <label class="form-label col-xs-4 col-sm-2">
  65. <font color='red'>* </font>是否使用优惠券:</label>
  66. <div class="formControls col-xs-6 col-sm-6">
  67. @if($order['use_coupon']=='0') 否 @else 是 @endif
  68. </div>
  69. </div>
  70. @endif
  71. <div class="row cl">
  72. <label class="form-label col-xs-4 col-sm-2">
  73. <font color='red'>* </font>收件人姓名:</label>
  74. <div class="formControls col-xs-6 col-sm-6">
  75. <input type="text" class="input-text" value="{{$order['receiverName']}}" placeholder="" name="receiverName">
  76. </div>
  77. </div>
  78. <div class="row cl">
  79. <label class="form-label col-xs-4 col-sm-2">
  80. <font color='red'>* </font>收件人手机号:</label>
  81. <div class="formControls col-xs-6 col-sm-6">
  82. <input type="text" class="input-text" value="{{$order['receiverMobile']}}" placeholder="" name="receiverMobile">
  83. </div>
  84. </div>
  85. <div class="row cl">
  86. <label class="form-label col-xs-4 col-sm-2">
  87. <font color='red'>* </font>省/直辖市:</label>
  88. <div class="formControls col-xs-6 col-sm-6">
  89. <input type="text" class="input-text" value="{{$order['receiverState']}}" placeholder="" name="receiverState">
  90. </div>
  91. </div>
  92. <div class="row cl">
  93. <label class="form-label col-xs-4 col-sm-2">
  94. <font color='red'>* </font>市:</label>
  95. <div class="formControls col-xs-6 col-sm-6">
  96. <input type="text" class="input-text" value="{{$order['receiverCity']}}" placeholder="" name="receiverCity">
  97. </div>
  98. </div>
  99. <!--div class="row cl">
  100. <label class="form-label col-xs-4 col-sm-2">
  101. 区:</label>
  102. <div class="formControls col-xs-6 col-sm-6">
  103. <input type="text" class="input-text" value="{{$order['receiverDistrict']}}" placeholder="" name="receiverDistrict">
  104. </div>
  105. </div>
  106. <div class="row cl">
  107. <label class="form-label col-xs-4 col-sm-2">
  108. 街道:</label>
  109. <div class="formControls col-xs-6 col-sm-6">
  110. <input type="text" class="input-text" value="{{$order['receiverStreet']}}" placeholder="" name="receiverStreet">
  111. </div>
  112. </div-->
  113. <div class="row cl">
  114. <label class="form-label col-xs-4 col-sm-2">
  115. <font color='red'>* </font>详细地址:</label>
  116. <div class="formControls col-xs-6 col-sm-6">
  117. <input type="text" class="input-text" value="{{$order['receiverAddress']}}" placeholder="" name="receiverAddress">
  118. </div>
  119. </div>
  120. <div class="row cl">
  121. <label class="form-label col-xs-4 col-sm-2">
  122. <font color='red'>* </font>预发货时间:</label>
  123. <div class="formControls col-xs-6 col-sm-6">
  124. <input id="delivery" type="text" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd' })" class="input-text Wdate" style="width:22%;text-align:center;" name="delivery_date" value="{{$order['delivery_date']}}"><font color='red'> </font>
  125. </div>
  126. </div>
  127. @if($self_role == '超级管理员' || $self_role == '售后管理员')
  128. <div class="row cl">
  129. <label class="form-label col-xs-4 col-sm-2">
  130. <font color='red'>* </font>发货仓库:</label>
  131. <div class="formControls col-xs-6 col-sm-6">
  132. <span class="select-box">
  133. <select size="1" name="warehouse" id='warehouse'>
  134. <option value="0" @if($order['warehouse']=='0') selected @endif>- 请选择 -</option>
  135. @foreach($warehouseArr as $warehouseVal=>$warehouseName)
  136. <option value="{{$warehouseVal}}" @if($order['warehouse']==$warehouseVal) selected @endif>{{$warehouseName}}</option>
  137. @endforeach
  138. </select>
  139. </span>
  140. </div>
  141. </div>
  142. @else
  143. <div class="row cl">
  144. <label class="form-label col-xs-4 col-sm-2">
  145. <font color='red'>* </font>发货仓库:</label>
  146. <div class="formControls col-xs-6 col-sm-6">
  147. {{$warehouseArr[$order['warehouse']]}}
  148. <input type="hidden" name="warehouse" id='warehouse' value="{{$order['warehouse']}}"/>
  149. </div>
  150. </div>
  151. @endif
  152. @if( $order['status'] <2 || !$order['goods'] )
  153. <div class="row cl">
  154. <label class="form-label col-xs-4 col-sm-2">搜索选择商品:</label>
  155. <div class="formControls col-xs-6 col-sm-6">
  156. <input type='text' class="input-text" autocomplete="off" name='goods_name' placeholder="输入关键词搜索商品,C仓必须选择" value=''/>
  157. <ul id="good_sku"></ul>
  158. </div>
  159. </div><br>
  160. @endif
  161. <div class="row cl">
  162. <label class="form-label col-xs-4 col-sm-2">
  163. <font color='red'>* </font>已选择商品:</label>
  164. <div id='goods_o' class="formControls col-xs-6 col-sm-6">
  165. <input class="input-text" id='g_info' type='hidden' name='g_info' value=''/>
  166. @if($order['goods'])
  167. @foreach($order['goods'] as $k=>$good)
  168. <p>{{$good['name']}} 【 规格:{{$good['props_name']}} 库存:{{$good['quantity_str']}}】&nbsp; <input type='hidden' name='skus[]' value="{{$good['sku_id']}}" /><font style="font-weight: bold;"> @if($good['is_weigh']==0) 数量 @else重量 @endif</font> @if($order['status'] < 2)<button style='width:14px;' type='button' onclick="cut_num({{$good['sku_id']}},{{$good['price']}})">-</button><input style='width:45px;' id='gnum{{$good["sku_id"]}}' class='gnums' price='{{$good["price"]}}' is_weigh='{{$good["is_weigh"]}}' quantity='{{$good["quantity"]}}' is_white='{{$good["is_white"]}}' type='text' name='gnum[]' value='{{$good["num"]}}' /><button style='width:14px;' type='button' onclick="add_num({{$good['sku_id']}},{{$good['price']}})">+</button>@if($good['is_weigh']==1)(斤) @endif &nbsp;&nbsp; <button type='button' onclick="del_sku(this,{{$good['sku_id']}},{{$good['price']}})"> 移除</button>@if($good['is_weigh']==1) &nbsp;&nbsp;<font color='red'>(称重商品,至少0.5斤) </font> @endif @else :{{$good["num"]}} @if($good['is_weigh']==1)斤【称重商品】 @endif<input type='hidden' id='gnum{{$good["sku_id"]}}' class='gnums' price='{{$good["price"]}}' name='gnum[]' value='{{$good["num"]}}' /> @endif </p>
  169. @endforeach
  170. @endif
  171. </div>
  172. </div><br>
  173. @if($order['status'] < 2)
  174. <div id='m_gift_div' class="row cl" @if(empty($order_m_gifts) && $cust_info['if_m_gift'] != '1') style="display: none" @endif>
  175. <label class="form-label col-xs-4 col-sm-2">
  176. <font color='red'> </font>选择会员当月赠品</label>
  177. <div class="formControls col-xs-6 col-sm-6">
  178. <span class="select-box">
  179. <select size="1" name="m_gift_id" id='m_gift'>
  180. <option value="0" @if(old('m_gift_id')=='0') selected @endif>- 请选择 -</option>
  181. @foreach($m_gift as $item)
  182. <option value="{{$item['id']}}" @if( in_array($item['id'], $order_m_gifts) ) selected @endif>{{$item['goods_name']}}【{{$item['propsName']}} ¥{{$item['price']}}】</option>
  183. @endforeach
  184. </select>
  185. </span>
  186. </div>
  187. </div>
  188. <div id='b_gift_div' class="row cl" @if(empty($order_b_gifts) && $cust_info['if_b_gift'] != '1') style="display: none" @endif>
  189. <label class="form-label col-xs-4 col-sm-2">
  190. <font color='red'> </font>是否使用生日套餐</label>
  191. <div class="formControls col-xs-6 col-sm-6">
  192. <input type="radio" name="use_b_gift" value="0" @if($order['use_b_gift']=='0') checked @endif>
  193. <label for="status-0" style="margin-right: 27px;">否</label>
  194. <input type="radio" name="use_b_gift" value="1" @if($order['use_b_gift']=='1') checked @endif>
  195. <label for="status-1">是</label>
  196. </div>
  197. </div>
  198. @else
  199. <div id='m_gift_div' class="row cl" @if(empty($order_m_gifts) && $cust_info['if_m_gift'] != '1') style="display: none" @endif>
  200. <label class="form-label col-xs-4 col-sm-2">
  201. <font color='red'> </font>选择会员当月赠品</label>
  202. <div class="formControls col-xs-6 col-sm-6">
  203. <span class="select-box">
  204. <select size="1" name="m_gift_id" id='m_gift' disabled>
  205. <option value="0" @if(old('m_gift_id')=='0') selected @endif>- 请选择 -</option>
  206. @foreach($m_gift as $item)
  207. <option value="{{$item['id']}}" @if( in_array($item['id'], $order_m_gifts) ) selected @endif>{{$item['goods_name']}}【{{$item['propsName']}} ¥{{$item['price']}}】</option>
  208. @endforeach
  209. </select>
  210. </span>
  211. </div>
  212. </div>
  213. <div id='b_gift_div' class="row cl" @if(empty($order_b_gifts) && $cust_info['if_b_gift'] != '1') style="display: none" @endif>
  214. <label class="form-label col-xs-4 col-sm-2">
  215. <font color='red'> </font>是否使用生日套餐</label>
  216. <div class="formControls col-xs-6 col-sm-6">
  217. @if($order['use_b_gift']=='0') 否 @else 是 @endif
  218. </div>
  219. </div>
  220. @endif
  221. <div class="row cl" style='display: none'>
  222. <label class="form-label col-xs-4 col-sm-2">
  223. 应收金额:</label>
  224. <div class="formControls col-xs-6 col-sm-6">
  225. <span id='should_amount_show'>{{$order['should_amount']}}</span>
  226. <input id='should_amount' type="hidden" class="input-text" value="{{$order['should_amount']}}" placeholder="" name="should_amount">
  227. </div>
  228. </div>
  229. @if( $order['status']>1 && $self_role !='超级管理员')
  230. <div class="row cl">
  231. <label class="form-label col-xs-4 col-sm-2">
  232. <font color='red'>* </font>实付金额:</label>
  233. <div class="formControls col-xs-6 col-sm-6">
  234. <input type="text" class="input-text" value="{{$order['receivedAmount']}}" placeholder="" readonly />
  235. <input type="hidden" id='receivedAmount' class="input-text" value="{{$order['receivedAmount']}}" name="receivedAmount"/>
  236. </div>
  237. </div>
  238. @else
  239. <div class="row cl">
  240. <label class="form-label col-xs-4 col-sm-2">
  241. <font color='red'>* </font>实付金额:</label>
  242. <div class="formControls col-xs-6 col-sm-6">
  243. <input type="text" id='receivedAmount' class="input-text" value="{{$order['receivedAmount']}}" placeholder="" name="receivedAmount">
  244. </div>
  245. </div>
  246. @endif
  247. @if($order['payment_type']=='4')
  248. <div class="row cl">
  249. <label class="form-label col-xs-4 col-sm-2">
  250. <font color='red'>* </font>支付方式:</label>
  251. <div class="formControls col-xs-6 col-sm-6">
  252. <input type="radio" name="payment_type" value="4" checked >
  253. <label for="status-0" style="margin-right: 27px;">充值卡支付</label>
  254. </div>
  255. </div>
  256. @else
  257. <div class="row cl">
  258. <label class="form-label col-xs-4 col-sm-2">
  259. <font color='red'>* </font>支付方式:</label>
  260. <div class="formControls col-xs-6 col-sm-6">
  261. <input type="radio" name="payment_type" value="1" @if($order['payment_type']=='1') checked @endif>
  262. <label for="status-1" style="margin-right: 27px;">微信支付</label>
  263. @if($order['payment_type']=='2')
  264. <input type="radio" name="payment_type" value="2" checked >
  265. <label for="status-0" style="margin-right: 27px;">付款码支付</label>
  266. @endif
  267. <input type="radio" name="payment_type" value="3" @if($order['payment_type']=='3') checked @endif>
  268. <label for="status-0" style="margin-right: 27px;">个体户支付</label>
  269. @if($self_role != '分销销售' && $self_role != '分销管理员')
  270. <input type="radio" name="payment_type" value="4" @if($order['payment_type']=='4') checked @endif>
  271. <label for="status-0" style="margin-right: 27px;">充值卡支付</label>
  272. @endif
  273. </div>
  274. </div>
  275. @endif
  276. @if($order['payment_type'] != 4)
  277. <div class="row cl" style="display: none" id='deposit_div'>
  278. <label class="form-label col-xs-4 col-sm-2">
  279. <font color='red'> </font>充值卡号:</label>
  280. <div class="formControls col-xs-6 col-sm-6">
  281. <input id='deposit_phone' type="text" class="input-text" value="{{old('deposit_phone')}}" onkeyup="getBalance()" placeholder="" name="deposit_phone">
  282. <font color='red' id='vip_pay'></font>
  283. </div>
  284. </div>
  285. @else
  286. <div class="row cl" id='deposit_div'>
  287. <label class="form-label col-xs-4 col-sm-2">
  288. <font color='red'> </font>充值卡号:</label>
  289. <div class="formControls col-xs-6 col-sm-6">
  290. {{$deposit_phone}}
  291. <input type="hidden" name='deposit_phone' value="{{$deposit_phone}}" />
  292. <font color='red' id='vip_pay'></font>
  293. </div>
  294. </div>
  295. @endif
  296. <div class="row cl">
  297. <label class="form-label col-xs-4 col-sm-2">
  298. <font color='red'>* </font>是否退补单:</label>
  299. <div class="formControls col-xs-6 col-sm-6">
  300. <input type="radio" name="is_refund" value="0" @if($order['is_refund']=='0') checked @else checked @endif>
  301. <label for="status-1" style="margin-right: 27px;">否</label>
  302. <input type="radio" name="is_refund" value="1" @if($order['is_refund']=='1') checked @endif>
  303. <label for="status-0">是</label>
  304. </div>
  305. </div>
  306. <div class="row cl">
  307. <label class="form-label col-xs-4 col-sm-2">
  308. 应该退补差价:</label>
  309. <div class="formControls col-xs-6 col-sm-6">
  310. <input type="text" class="input-text" value="{{$order['refund_price']}}" placeholder="" name="refund_price">
  311. </div>
  312. </div>
  313. <div class="row cl">
  314. <label class="form-label col-xs-4 col-sm-2">
  315. <font color='red'>* </font>是否复购:</label>
  316. <div class="formControls col-xs-6 col-sm-6">
  317. <input type="radio" name="is_fugou" value="0" @if($order['is_fugou']=='0') checked @else checked @endif>
  318. <label for="status-1" style="margin-right: 27px;">否</label>
  319. <input type="radio" name="is_fugou" value="1" @if($order['is_fugou']=='1') checked @endif>
  320. <label for="status-0">是</label>
  321. </div>
  322. </div>
  323. <div class="row cl">
  324. <label class="form-label col-xs-4 col-sm-2">
  325. <font color='red'>* </font>是否退款:</label>
  326. <div class="formControls col-xs-6 col-sm-6">
  327. <input type="radio" name="order_status" value="0" @if($order['order_status']=='0') checked @else checked @endif>
  328. <label for="status-1" style="margin-right: 27px;">否</label>
  329. <input type="radio" name="order_status" value="2" @if($order['order_status']=='2') checked @endif>
  330. <label for="status-2">是</label>
  331. </div>
  332. </div>
  333. <div class="row cl">
  334. <label class="form-label col-xs-4 col-sm-2">
  335. <font color='red'>* </font>下单时间:</label>
  336. <div class="formControls col-xs-6 col-sm-6">
  337. <input id="createTime" type="text" class="input-text" style="width:22%;text-align:center;" name="createTime" value="{{$order['createTime']}}" disabled> <font color='red'> *不可变更 </font>
  338. </div>
  339. </div>
  340. <div class="row cl">
  341. <label class="form-label col-xs-4 col-sm-2">
  342. 买家备注:</label>
  343. <div class="formControls col-xs-6 col-sm-6">
  344. <textarea class="textarea" placeholder="填写买家备注..." name="buyerMemo">{{$order['buyerMemo']}}</textarea>
  345. </div>
  346. </div>
  347. <div class="row cl">
  348. <label class="form-label col-xs-4 col-sm-2">
  349. 卖家备注:</label>
  350. <div class="formControls col-xs-6 col-sm-6">
  351. <textarea class="textarea" placeholder="填写卖家备注..." name="sellerMemo">{{$order['sellerMemo']}}</textarea>
  352. </div>
  353. </div>
  354. @if(0)
  355. @if($self_role !='销售' && $self_role != '分销销售' )
  356. <div class="row cl">
  357. <label class="form-label col-xs-4 col-sm-2">
  358. 选择销售员(不选默认当前用户):</label>
  359. <div class="formControls col-xs-6 col-sm-6">
  360. <span class="select-box">
  361. <select size="1" name="team" id='team'>
  362. <option value="0" @if($order['team_id']=='') selected @endif>选择团队</option>
  363. @foreach($teamlist as $v)
  364. <option value="{{$v['id']}}" @if($order['team_id']==$v['id']) selected @endif>{{$v['name']}}</option>
  365. @endforeach
  366. </select>
  367. <select id='admins' size="1" name="admin_id">
  368. <option value="0" @if($order['admin_id']=='') selected @endif>-- 选择销售 --</option>
  369. @foreach($adminlist as $v)
  370. <option value="{{$v['id']}}" @if($order['admin_id']==$v['id']) selected @endif>{{$v['realname']}}</option>
  371. @endforeach
  372. </select>
  373. &nbsp;&nbsp;
  374. </span>
  375. </div>
  376. </div>
  377. @endif
  378. @endif
  379. @endif
  380. <div class="row cl">
  381. <div class="col-9 col-offset-2">
  382. <button class="btn btn-primary radius" type="button" onclick="to_submit()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>&nbsp;
  383. <button class="btn btn-default" type="reset" onclick="return_index();">&nbsp;&nbsp;返回&nbsp;&nbsp;</button>&nbsp;
  384. </div>
  385. </div>
  386. </form>
  387. </div>
  388. <!--_footer 作为公共模版分离出去-->
  389. <script type="text/javascript" src="/admin/lib/jquery/1.9.1/jquery.min.js"></script>
  390. <script type="text/javascript" src="/admin/lib/layer/2.4/layer.js"></script>
  391. <script type="text/javascript" src="/admin/static/h-ui/js/H-ui.min.js"></script>
  392. <script type="text/javascript" src="/admin/static/h-ui.admin/js/H-ui.admin.js"></script>
  393. <!--/_footer 作为公共模版分离出去-->
  394. <!--请在下方写此页面业务相关的脚本-->
  395. <script type="text/javascript" src="/admin/lib/My97DatePicker/4.8/WdatePicker.js"></script>
  396. <script type="text/javascript">
  397. $(function(){
  398. setTimeout("$('#error').hide()",3000);
  399. $('#team').change(function(){
  400. team = $('#team').val();
  401. if(team==''){
  402. return false;
  403. }
  404. $.ajax({
  405. 'url':'/admin/order/teamAdmins/'+team,
  406. 'type': 'get',
  407. 'dataType':'json',
  408. 'success' : function(data){
  409. str = '<option value=\'0\'>-- 选择销售 --<\/option>';
  410. $.each(data, function(i, va){
  411. str += '<option value="'+va.id+'">' + va.realname +'<\/option>';
  412. })
  413. $('#admins').html(str);
  414. }
  415. });
  416. })
  417. $('input[type=radio][name=payment_type]').change(function () {
  418. var payment_type = $("input[type='radio'][name='payment_type']:checked").val();
  419. if(payment_type==4){
  420. var phone = "{{$deposit_phone}}";
  421. $("#deposit_phone").val(phone);
  422. $("#deposit_phone_i").val(phone);
  423. //获取充值卡余额
  424. var reg = /^1\d{10}$/
  425. if(!reg.test(phone)){
  426. return false;
  427. }
  428. $.ajax({
  429. 'url':'/admin/cust/getBalance/'+phone,
  430. 'type': 'get',
  431. 'success' : function(data){
  432. var str = '【充值卡余额为:'+data+'元】';
  433. $("#vip_pay").html(str);
  434. }
  435. });
  436. $("#deposit_div").show();
  437. }else{
  438. $("#deposit_div").hide();
  439. }
  440. })
  441. });
  442. function getBalance(){
  443. var phone = $("input[name=deposit_phone]").val();
  444. var reg = /^1\d{10}$/
  445. if(!reg.test(phone)){
  446. $("#vip_pay").html('【充值卡余额为:0元】');
  447. return false;
  448. }
  449. //获取充值卡余额
  450. $.ajax({
  451. 'url':'/admin/cust/getBalance/'+phone,
  452. 'type': 'get',
  453. 'success' : function(data){
  454. var str = '【充值卡余额为:'+data+'元】';
  455. $("#vip_pay").html(str);
  456. }
  457. });
  458. }
  459. /*返回*/
  460. function return_index(){
  461. location.href='/admin/order/index';
  462. }
  463. function add_goods(goods_id,sku_id,name,props_name,price,is_weigh,quantity,is_white){
  464. var gnum = $("#gnum"+sku_id).val();
  465. var weigh_unit = '数量';
  466. var weigh_note = '';
  467. var weigh_unit_name = '';
  468. if(is_weigh == 1){
  469. weigh_unit = '重量';
  470. weigh_unit_name = '(斤)';
  471. weigh_note = '<font color=\'red\'> (称重商品,至少0.5斤) <\/font>';
  472. }
  473. if(gnum){
  474. var n = gnum;
  475. n = parseFloat(n)+1
  476. $("#gnum"+sku_id).val(n);
  477. }
  478. else{
  479. var quantity_str = '库存:'+quantity;
  480. if(is_white==1){
  481. quantity_str = '虚拟库存';
  482. }
  483. var str = "<div>"+name+' 【 规格:'+props_name+' '+quantity_str+" 】&nbsp; <input type='hidden' name='skus[]' value="+sku_id+" \/><font style=\"font-weight: bold;\">"+weigh_unit+" <\/font><button style='width:14px;' type='button' onclick=\"cut_num("+sku_id+","+ price + ","+ is_weigh +")\">-<\/button><div style=\"display:inline-block\" id='gnum_con"+ sku_id +"' ><input style='width:40px;' id='gnum"+ sku_id +"' class='gnums' onkeyup='sync_money();' price="+price+" is_weigh="+is_weigh+" quantity="+quantity+" is_white="+is_white+" type=\'text\' name=\'gnum[]\' value=1 \/><\/div><button style='width:14px;' type='button' onclick=\"add_num("+sku_id+","+ price + ","+ is_weigh +")\">+<\/button>"+weigh_unit_name+" &nbsp;&nbsp;<button type='button' onclick='del_sku(this, "+sku_id+","+ price + ")'> 移除<\/button> &nbsp;&nbsp;"+weigh_note+"<\/div>";
  484. $("#goods_o").append(str);
  485. sessionStorage.setItem('goods_o_con',$("#goods_o").html());
  486. }
  487. sync_money()
  488. document.getElementById('good_sku').style.display='none'
  489. return false;
  490. }
  491. function add_num(sku_id, price){
  492. var gnum = $("#gnum"+sku_id).val();
  493. var n = gnum;
  494. n = parseFloat(n)+1
  495. $("#gnum"+sku_id).val(n);
  496. sync_money()
  497. return false;
  498. }
  499. function cut_num(sku_id, price){
  500. var gnum = $("#gnum"+sku_id).val();
  501. var n = gnum;
  502. if(n <= 1){
  503. return false;
  504. }
  505. n = parseFloat(n)-1;
  506. $("#gnum"+sku_id).val(n);
  507. sync_money()
  508. return false;
  509. }
  510. function del_sku(obj, sku_id, price){
  511. var gnum = $("#gnum"+sku_id).val();
  512. $(obj).parent().remove();
  513. sync_money();
  514. }
  515. function sync_money(){
  516. var gnums = new Array();
  517. var total = 0;
  518. $('.gnums').each(function(key, value){
  519. var gnum = $(this).val();
  520. var price = $(this).attr('price');
  521. total = total + parseFloat(price) * parseFloat(gnum);
  522. });
  523. if(total>0){
  524. $("#should_amount").val(total);
  525. $("#should_amount_show").html(total);
  526. }else{
  527. $("#should_amount").val('');
  528. $("#should_amount_show").html('');
  529. }
  530. return false;
  531. }
  532. function getGoods(){
  533. var name = $('input[name=goods_name]').val();
  534. if(!name){
  535. return false;
  536. }
  537. $.ajax({
  538. 'url': '/admin/goods/searchSkus',
  539. 'type': 'get',
  540. 'data':{name:name},
  541. 'dateType': 'json',
  542. success:function(data){
  543. if(data != '0'){
  544. data = eval("("+data+")");
  545. }
  546. }
  547. })
  548. }
  549. $('input[name=goods_name]').on('keyup focus', function(){
  550. var name = $('input[name=goods_name]').val();
  551. if(!name){
  552. return false;
  553. }
  554. $.ajax({
  555. 'url': '/admin/goods/searchSkus',
  556. 'type': 'get',
  557. 'data':{name:name},
  558. 'dateType': 'json',
  559. success:function(data){
  560. if(data != '0'){
  561. data = eval("("+data+")");
  562. var str = '';
  563. for (var i = 0, l = data.length; i < l; i++) {
  564. var item = data[i];
  565. var weigh_t = '';
  566. if(item.is_weigh==1){
  567. weigh_t = '【按半斤称重】';
  568. }
  569. if(item.is_white == 0 && item.quantity <= 0){
  570. weigh_t += '<font color="red">【库存不足】<\/font>';
  571. str += '<li>'+ item.name+'【 规格:'+item.propsName+'&nbsp;&nbsp; 】'+weigh_t+'<\/li>'
  572. }
  573. else{
  574. str += '<li onclick=\'add_goods('+item.goods_id+','+item.sku_id+',"'+item.name+'","'+item.propsName+'",'+item.price+','+item.is_weigh+','+item.quantity+','+item.is_white+');\'>'+ item.name+'【 规格:'+item.propsName+'&nbsp;&nbsp; 】'+weigh_t+'<\/li>'
  575. }
  576. // '<p onclick=\'add_goods('+item.goods_id+','+item.sku_id+',"'+item.name+'","'+item.propsName+'",'+item.price+');\'>'+ item.name+' '+item.propsName+' ¥'+item.price +'<\/p>';
  577. }
  578. document.getElementById('good_sku').innerHTML = str;
  579. document.getElementById('good_sku').style.display='block'
  580. // layer.open({
  581. // type: 1,
  582. // area: ['600px', '360px'],
  583. // shadeClose: true, //点击遮罩关闭
  584. // content: str
  585. // });
  586. }
  587. }
  588. })
  589. });
  590. $('body').on('click', function(){
  591. $('input[name=goods_name]').on('click',function(e){
  592. e.stopPropagation();
  593. });
  594. document.getElementById('good_sku').style.display='none'
  595. })
  596. function to_submit(){
  597. if(!form_verify()){
  598. return false;
  599. }
  600. var warehouse = $("#warehouse").val();
  601. if(warehouse == 3){
  602. var if_good = $('.gnums');
  603. if(!if_good.length){
  604. layer.msg('仓库C必须选择商品!',{icon:2,time:1000});
  605. return false;
  606. }
  607. }
  608. $(".btn").attr("disabled",true);
  609. $("#order-form").submit();
  610. return true;
  611. }
  612. function weigh_verify(){
  613. var if_no = 0;
  614. $('.gnums').each(function(key, value){
  615. var gnum = $(this).val();
  616. gnum = parseFloat(gnum);
  617. var is_weigh = $(this).attr('is_weigh');
  618. if(gnum<0.5){
  619. if_no = 1;
  620. return;
  621. }
  622. if(is_weigh == 0 && gnum%1 != 0){
  623. if_no = 2;
  624. return;
  625. }
  626. if(is_weigh == 1 && gnum%0.5 != 0){
  627. if_no = 3;
  628. return;
  629. }
  630. var quantity = $(this).attr('quantity');
  631. var is_white = $(this).attr('is_white');
  632. if(is_white==0 && gnum>quantity){
  633. if_no=4;
  634. return;
  635. }
  636. });
  637. return if_no;
  638. }
  639. function form_verify(){
  640. //验证称重>0.5
  641. var if_no = weigh_verify();
  642. if(if_no > 0){
  643. if(if_no == 1){
  644. layer.msg('商品数量填写有误!',{icon:2,time:1500});
  645. }
  646. if(if_no == 2){
  647. layer.msg('非称重商品数量必须为整数!',{icon:2,time:1500});
  648. }
  649. if(if_no == 3){
  650. layer.msg('称重商品重量必须为0.5的倍数!',{icon:2,time:1500});
  651. }
  652. if(if_no == 4){
  653. layer.msg('商品数量不得大于库存量!',{icon:2,time:1500});
  654. }
  655. return false;
  656. }
  657. //验证充值卡
  658. var old_payment_type = "{{$order['payment_type']}}";
  659. var old_receivedAmount = "{{$order['receivedAmount']}}";
  660. old_receivedAmount = parseFloat(old_receivedAmount);
  661. var is_ok = 1;
  662. var receivedAmount = $("input[name=receivedAmount]").val();
  663. var payment_type = $("input[type='radio'][name='payment_type']:checked").val();
  664. if( payment_type==4 ){
  665. use_coupon = $("input[type='radio'][name='use_coupon']:checked").val();
  666. if(use_coupon == 1){
  667. layer.msg('充值卡不能和优惠券同时使用!',{icon:2,time:1500});
  668. return false;
  669. }
  670. }
  671. if( payment_type==4 && old_payment_type != 4 ){
  672. var phone = $("input[name=deposit_phone]").val();
  673. if(!phone){
  674. is_ok = 0;
  675. }
  676. //获取充值卡余额
  677. $.ajax({
  678. url:'/admin/cust/getBalance/'+phone,
  679. type: 'get',
  680. async:false,
  681. success : function(data){
  682. data=parseFloat(data);
  683. receivedAmount=parseFloat(receivedAmount);
  684. if(data<receivedAmount){
  685. is_ok = 0;
  686. }else{
  687. is_ok = 1;
  688. }
  689. }
  690. });
  691. if(is_ok==0){
  692. layer.msg('充值卡余额不足,请充值后再进行该操作!',{icon:2,time:1500});
  693. return false;
  694. }
  695. }
  696. if( payment_type==4 && old_payment_type==4 && old_receivedAmount != receivedAmount ){
  697. var phone = "{{$deposit_phone}}"
  698. if(old_receivedAmount < receivedAmount){
  699. //金额增加,判断余额
  700. var money = receivedAmount - old_receivedAmount;
  701. //获取充值卡余额
  702. $.ajax({
  703. url:'/admin/cust/getBalance/'+phone,
  704. type: 'get',
  705. async:false,
  706. success : function(data){
  707. data=parseFloat(data);
  708. money=parseFloat(money);
  709. if(data<money){
  710. is_ok = 0;
  711. }else{
  712. is_ok = 1;
  713. }
  714. }
  715. });
  716. }
  717. if(is_ok==0){
  718. layer.msg('充值卡余额不足,请充值后再进行该操作!',{icon:2,time:1500});
  719. return false;
  720. }
  721. }
  722. return true;
  723. }
  724. </script>
  725. </body>
  726. @endsection