reserve.php 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. <?php
  2. use common\helpers\ComponentHelper;
  3. ComponentHelper::loadComponentView('component/order-address', __DIR__);
  4. ComponentHelper::loadComponentView('component/order-shipping', __DIR__);
  5. ComponentHelper::loadComponentView('com-export-dialog');
  6. ?>
  7. <div id="app" v-cloak>
  8. <el-tabs type="border-card" v-model="orderTypeTab" @tab-click="orderTypeTabClick">
  9. <el-tab-pane label="商品订单" name="gorder">
  10. </el-tab-pane>
  11. <el-tab-pane label="服务订单" name="rorder">
  12. <el-card shadow="never" body-style="background-color: #f3f3f3;padding: 10px 0 0;" v-loading="listLoading">
  13. <div slot="header">
  14. <span>订单列表</span>
  15. <div style="float: right; margin: -5px 0">
  16. <!-- <el-button type="primary" size="small" @click="handle('edit')">添加商品</el-button>-->
  17. <!-- <el-button type="primary" size="small">订单导出</el-button>-->
  18. <!-- <com-export-dialog
  19. style="float: right;margin-top: -5px"
  20. :field_list='export_list'
  21. :action_url="export_url"
  22. :params="search_data">
  23. </com-export-dialog> -->
  24. </div>
  25. </div>
  26. <div class="table-body">
  27. <el-tabs v-model="activeName" @tab-click="handleClick">
  28. <el-tab-pane v-for="item in tabs" :key="item.value" :label="item.name" :name="item.value">
  29. <el-form :inline="true" :model="search_data" size="small" class="demo-form-inline">
  30. <el-form-item label="下单时间">
  31. <el-date-picker style="margin-top: 1px;" @change="changeTime" v-model="datetime" type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']"></el-date-picker>
  32. </el-form-item>
  33. <el-form-item label="">
  34. <el-input placeholder="请输入订单号" v-model="search_data.order_no"></el-input>
  35. </el-form-item>
  36. <el-form-item label="">
  37. <el-input placeholder="请输入内容" v-model="search_data.type_value" class="input-with-select">
  38. <el-select v-model="search_data.type" slot="prepend" placeholder="请选择">
  39. <el-option label="用户ID" value="user_id"></el-option>
  40. <el-option label="手机号码" value="mobile"></el-option>
  41. </el-select>
  42. </el-input>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="primary" @click="search">搜索</el-button>
  46. <el-button type="danger" @click="clearSearch" v-if="show_clear_search_btn">清除条件</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <!-- 订单表格 start -->
  50. <div class="order-table">
  51. <ul class="tab-title" flex="dir:left cross:center">
  52. <li class="width-50" flex="main:center">
  53. <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="allSelOrder"></el-checkbox>
  54. </li>
  55. <li class="width-400">商品信息</li>
  56. <li class="width-pre10">价格/数量</li>
  57. <li class="width-pre10">实付款</li>
  58. <li class="width-s">服务地址</li>
  59. <li class="width-s" v-if="is_show_username==1">真实姓名</li>
  60. <li class="width-pre10">状态</li>
  61. <li class="width-pre10">门店名称</li>
  62. <li class="">操作</li>
  63. </ul>
  64. <div class="tab-cont" v-for="(item, index) in list" :key="index">
  65. <div class="tab-cont-row" flex="main:justify cross:center">
  66. <div flex="dir:left cross:center">
  67. <div class="width-50" flex="main:center">
  68. <!-- <el-checkbox v-model="item.select" @change=""></el-checkbox> -->
  69. <el-checkbox-group v-model="checkedOrder" @change="orderChange">
  70. <el-checkbox :label="item.id">{{''}}</el-checkbox>
  71. </el-checkbox-group>
  72. </div>
  73. <div style="padding-right: 20px;">订单({{ item.id }})编号:{{ item.order_no || '-' }}</div>
  74. <div v-if="item.base_user" style="padding-right: 20px;">用户({{item.base_user.id}}):{{ item.base_user.nickname || item.base_user.username }}</div>
  75. <div style="padding-right: 20px;">下单时间:{{ item.created_at|dateTimeFormat('Y-m-d H:i:s')}}</div>
  76. <el-tag size="small" style="padding-right: 20px;" v-if="marketing_type_map[item.marketing_type]">{{marketing_type_map[item.marketing_type]}}</el-tag>
  77. <el-tag size="small" v-if="item.reserve" :type="reserve_type_text[item.reserve.reserve_type].type">
  78. {{reserve_type_text[item.reserve.reserve_type].title}}
  79. </el-tag>
  80. </div>
  81. </div>
  82. <ul class="tab-cont-info" flex="dir:left cross:center" v-for="(it, i) in item.detail" v-if="true">
  83. <li class="width-50" :class="i == item.detail.length - 1 ? 'no-border-bottom' : 'border-bottom'"></li>
  84. <li class="tab-shop-info width-400" flex="dir:left" :class="i == item.detail.length - 1 ? 'no-border-bottom' : 'border-bottom'">
  85. <div style="position: relative;">
  86. <el-image style="width: 50px; height: 50px; border-radius: 5px;" :src="it.pic_url"></el-image>
  87. <span v-if="repeal_list[it.is_feedback]" class="com-order-refund-status">{{ repeal_list[it.is_feedback] }}</span>
  88. </div>
  89. <div class="tab-goods-name">
  90. <com-ellipsis :line="1" :text="it.goods_name+''"></com-ellipsis>
  91. <template>
  92. <el-tag style="margin-right: 2px;margin-top: 5px;" size="small">
  93. {{ it.goods_attr_name || '无规格' }}
  94. </el-tag>
  95. </template>
  96. </div>
  97. </li>
  98. <li class="width-pre10 border-right" :class="i == item.detail.length - 1 ? 'no-border-bottom' : 'border-bottom'">
  99. <div class="cursor" flex="cross:center" @mouseover="mouseOver(index, i)" @mouseleave="mouseLeave">
  100. <p style="padding-right: 10px;">
  101. {{ getOrderPrice(it) }}
  102. <span v-if="it.adjust_money != 0">(调价:¥{{ it.adjust_money }})</span>
  103. </p>
  104. </div>
  105. <p>{{ it.num }}件</p>
  106. </li>
  107. <li class="width-pre10 border-right">
  108. <div v-show="i == 0">
  109. <p>{{ item.pay_money }}</p>
  110. <p>(含运费¥{{ item.shipping_money }})</p>
  111. <p>
  112. <el-tag size="small" type="warning">{{payment_type_list[item.payment_type]}}</el-tag>
  113. </p>
  114. </div>
  115. </li>
  116. <li class="width-s border-right">
  117. <div v-show="i == 0">
  118. <p>{{ item.receiver_name | emptyFilled }}</p>
  119. <p>{{ item.mobile |emptyFilled}} </p>
  120. <p style="display: flex;align-items: center;">
  121. <com-ellipsis v-if="(item.region_name + item.address).trim() != 'null'" :line="1" :text="item.region_name + item.address + ''"></com-ellipsis>
  122. <span v-else>--</span>
  123. </p>
  124. </div>
  125. </li>
  126. <li class="width-s border-right" v-if="is_show_username==1&&item.base_user">
  127. <div v-show="i == 0">
  128. <p>{{ item.base_user.username }}</p>
  129. </div>
  130. </li>
  131. <li class="width-pre10 border-right">
  132. <div v-show="i == 0">
  133. <el-tag size="small">{{ order_status_list[item.order_status] }}</el-tag>
  134. </div>
  135. </li>
  136. <li class="width-pre10 border-right">
  137. <div v-show="i == 0">
  138. <el-tag size="small">{{ item.store_name }}</el-tag>
  139. </div>
  140. </li>
  141. <li v-show="i == 0">
  142. <el-button size="small" type="text" @click="handle('detail',item)">详情</el-button>
  143. <el-button v-if="item.Printer && item.Printer.is_show_printer==1" size="small" type="text" @click="handle('printer',item)">打印小票</el-button>
  144. <template v-for="operate_item in status_operate_list[item.order_status]['operate']">
  145. <el-button size="small" type="text" @click="handle(operate_item.code,item)">{{operate_item.name}}</el-button>
  146. </template>
  147. </li>
  148. </ul>
  149. </div>
  150. </div>
  151. <div style="text-align: right;margin: 20px 0;">
  152. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  153. </div>
  154. <!-- 订单表格 end -->
  155. </el-tab-pane>
  156. </el-tabs>
  157. </div>
  158. </el-card>
  159. </el-tab-pane>
  160. </el-tabs>
  161. <!-- TODO: 修改价格 (一期没有)-->
  162. <!-- <el-dialog title="订单改价" :visible.sync="isShowChangePrice">
  163. <el-form :model="change_price_form" ref="goodsValidateForm" label-width="80px" size="small">
  164. <el-table :data="change_price_form.detail" :span-method="objectSpanMethod" border>
  165. <el-table-column prop="goods_name" label="商品" width="180"></el-table-column>
  166. <el-table-column width="100" prop="price" label="单价(元)">
  167. <template slot-scope="scope">
  168. <span>{{scope.row.price}}元</span>
  169. </template>
  170. </el-table-column>
  171. <el-table-column width="50" prop="price" label="数量">
  172. <template slot-scope="scope">
  173. <span>{{scope.row.num}}</span>
  174. </template>
  175. </el-table-column>
  176. <el-table-column prop="goods_price" label="小计">
  177. <template slot-scope="scope">
  178. <span>{{scope.row.price*scope.row.num}}元</span>
  179. </template>
  180. </el-table-column>
  181. <el-table-column prop="discount_sum" label="优惠" >
  182. <template slot-scope="scope">
  183. <el-tooltip class="item" effect="dark" content="优惠 = 会员折扣 + 优惠券 + 积分抵扣 + 会员价 + 涨减价" placement="top">
  184. <span>{{(scope.row.discount_sum).toFixed(2)}}元</span>
  185. </el-tooltip>
  186. </template>
  187. </el-table-column>
  188. <el-table-column prop="" label="涨价或减价">
  189. <template slot-scope="scope">
  190. <el-input type="number" size="small" v-model="scope.row.adjust_money" @input="sumChangePrice(scope,$event)"></el-input>
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="" label="运费">
  194. <template slot-scope="scope">
  195. <el-input size="small" v-model="change_price_form.shipping_money" @input="sumChangeShipping($event)" onkeyup="if(value<0){value=0}else{value=toNumber(value,2)}"></el-input>
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. <div style="padding-top: 20px;" class="change_formula">
  200. <p> 实付总金额 = 小计 + 店铺优惠 + 小计涨减价 + 运费 </p>
  201. </div>
  202. <div style="padding-top: 20px;" class="change_price">
  203. <p> <label>实付总金额 </label> ¥{{change_price_form.new_pay_money}} </p>
  204. </div>
  205. </el-form>
  206. <div slot="footer" class="dialog-footer">
  207. <el-button @click="isShowChangePrice = false">取 消</el-button>
  208. <el-button type="primary" @click="handle('change_price',change_price_form,true)" :loading="changePriceLoading">确 定</el-button>
  209. </div>
  210. </el-dialog> -->
  211. <!-- TODO:备注 (一期没有)-->
  212. <!-- <el-dialog title="备注" width="600px" :visible.sync="isShowRemark">
  213. <el-form :model="remark_form" ref="goodsValidateForm" label-width="80px" size="small">
  214. <el-form-item label="" prop="remark">
  215. <el-input type="textarea" placeholder="卖家备注" v-model="remark_form.seller_remark"></el-input>
  216. </el-form-item>
  217. </el-form>
  218. <div slot="footer" class="dialog-footer">
  219. <el-button @click="isShowRemark = false">取 消</el-button>
  220. <el-button type="primary" @click="handle('remark',remark_form,true)" :loading="remarkLoading">确 定</el-button>
  221. </div>
  222. </el-dialog> -->
  223. <!-- TODO: 修改地址 (一期没有)-->
  224. <!-- <order-address :is_show="isShowChangeAddress" :change-address-loading="changeAddressLoading" @sure="handleChangeAddress" :order_info="change_address_form" @close="isShowChangeAddress = false"></order-address> -->
  225. <!-- TODO: 发货 -->
  226. <!-- <order-shipping :is_show="isShowChangeShipping" :change-shipping-loading="changeShippingLoading" :order_info="shipping_form" @submit="handleShipping" @close="isShowChangeShipping = false"></order-shipping> -->
  227. <el-dialog class="fenRunData" title="分润明细" :visible.sync="dialogTableVisible_fenRun">
  228. <el-tabs v-model="activeNames" @tab-click="commissionHandleClick">
  229. <el-tab-pane label="佣金" name="commission">
  230. <el-table :data="fenRunData">
  231. <el-table-column label="用户">
  232. <template slot-scope="scope">
  233. <div class="table-info-img-text">
  234. <el-image class="table-info-img circle" :src="scope.row.avatar_url">
  235. <div slot="error" class="image-slot">
  236. <el-image class="table-info-img" src="/resources/img/common/default-avatar.png"></el-image>
  237. </div>
  238. </el-image>
  239. <div class="table-info-text">
  240. <div>{{scope.row.nickname}}<span style="color:blue">({{scope.row.user_id}})</span></div>
  241. <div>{{scope.row.mobile}}</div>
  242. </div>
  243. </div>
  244. </template>
  245. </el-table-column>
  246. <el-table-column property="change_num" label="佣金"></el-table-column>
  247. <el-table-column property="is_frozen" label="状态"></el-table-column>
  248. <el-table-column property="capital_type_text" label="类型"></el-table-column>
  249. <el-table-column property="from_type_text" label="所属插件"></el-table-column>
  250. </el-table>
  251. </el-tab-pane>
  252. <el-tab-pane label="积分" name="score">
  253. <el-table :data="fenRunData">
  254. <el-table-column label="用户">
  255. <template slot-scope="scope">
  256. <image style="width: 50px;height: 50px; border-radius: 50%;" :src="scope.row.avatar_url? scope.row.avatar_url:'resources/img/mall/default_avatar_url.png'"></image>
  257. <div style="color:#000;">{{scope.row.nickname}}</div>
  258. </template>
  259. </el-table-column>
  260. <el-table-column property="change_num" label="积分"></el-table-column>
  261. <el-table-column property="is_frozen" label="状态"></el-table-column>
  262. <el-table-column property="capital_type_text" label="类型"></el-table-column>
  263. <el-table-column property="from_type_text" label="所属插件"></el-table-column>
  264. </el-table>
  265. </el-tab-pane>
  266. </el-tabs>
  267. </el-dialog>
  268. </div>
  269. <script>
  270. const app = new Vue({
  271. el: '#app',
  272. data() {
  273. return {
  274. orderTypeTab:'rorder',
  275. is_show_username: <?= $is_show_username ?>,
  276. price: 0,
  277. visibles: false,
  278. hidden: false,
  279. current: -1,
  280. detailIndex: -1,
  281. checkAll: false,
  282. checked: false,
  283. select: '',
  284. input3: '',
  285. goods_name: '',
  286. goods_id: '',
  287. is_show_change_price: true,
  288. marketing_type_map: {},
  289. reserve_type_text: [
  290. {
  291. title: '家政服务',
  292. type: 'danger'
  293. },
  294. {
  295. title: '预约服务',
  296. type: 'success'
  297. }
  298. ],
  299. // TODO: 一期操作只有 查看详情、分润明细
  300. status_operate_list: {
  301. '0': {
  302. operate: [
  303. // {
  304. // 'type': 'text',
  305. // 'name': '支付',
  306. // 'code': 'pay'
  307. // },
  308. // {
  309. // 'type': 'text',
  310. // 'name': '关闭交易',
  311. // 'code': 'cancel'
  312. // },
  313. // {
  314. // 'type': 'text',
  315. // 'name': '修改价格',
  316. // 'code': 'change_price'
  317. // },
  318. // {
  319. // 'type': 'text',
  320. // 'name': '备注',
  321. // 'code': 'remark'
  322. // },
  323. ]
  324. },
  325. '1': {
  326. operate: [
  327. // {
  328. // 'type': 'text',
  329. // 'name': '发货',
  330. // 'code': 'shipping'
  331. // }, {
  332. // 'type': 'text',
  333. // 'name': '修改地址',
  334. // 'code': 'change_address'
  335. // }, {
  336. // 'type': 'text',
  337. // 'name': '备注',
  338. // 'code': 'remark'
  339. // },
  340. {
  341. 'type': 'text',
  342. 'name': '分润明细',
  343. 'code': 'fen_run'
  344. },
  345. ]
  346. },
  347. '2': {
  348. operate: [
  349. // {
  350. // 'type': 'text',
  351. // 'name': '确认收货',
  352. // 'code': 'take-delivery'
  353. // }, {
  354. // 'type': 'text',
  355. // 'name': '备注',
  356. // 'code': 'remark'
  357. // },
  358. {
  359. 'type': 'text',
  360. 'name': '分润明细',
  361. 'code': 'fen_run'
  362. },
  363. ]
  364. },
  365. '3': {
  366. operate: [
  367. // {
  368. // 'type': 'text',
  369. // 'name': '订单完成',
  370. // 'code': 'sales'
  371. // },
  372. {
  373. 'type': 'text',
  374. 'name': '分润明细',
  375. 'code': 'fen_run'
  376. },
  377. ]
  378. },
  379. '4': {
  380. operate: [
  381. {
  382. 'type': 'text',
  383. 'name': '分润明细',
  384. 'code': 'fen_run'
  385. },
  386. ]
  387. },
  388. '6': {
  389. operate: [
  390. // {
  391. // 'type': 'text',
  392. // 'name': '确认自提',
  393. // 'code': 'shipping'
  394. // },
  395. // {
  396. // 'type': 'text',
  397. // 'name': '修改地址',
  398. // 'code': 'change_address'
  399. // },
  400. // {
  401. // 'type': 'text',
  402. // 'name': '备注',
  403. // 'code': 'remark'
  404. // },
  405. {
  406. 'type': 'text',
  407. 'name': '分润明细',
  408. 'code': 'fen_run'
  409. },
  410. ]
  411. },
  412. '7': {
  413. operate: [
  414. {
  415. 'type': 'text',
  416. 'name': '分润明细',
  417. 'code': 'fen_run'
  418. },
  419. ],
  420. },
  421. '-1': {
  422. operate: [{
  423. 'type': 'text',
  424. 'name': '售后审核',
  425. 'code': 'sales_review'
  426. },
  427. {
  428. 'type': 'text',
  429. 'name': '分润明细',
  430. 'code': 'fen_run'
  431. },
  432. ]
  433. },
  434. '-2': {
  435. operate: [{
  436. 'type': 'text',
  437. 'name': '售后完成',
  438. 'code': 'sales_finish'
  439. },
  440. {
  441. 'type': 'text',
  442. 'name': '分润明细',
  443. 'code': 'fen_run'
  444. },
  445. ]
  446. },
  447. '-3': {
  448. operate: [{
  449. 'type': 'text',
  450. 'name': '售后完成',
  451. 'code': 'sales_finish'
  452. },
  453. {
  454. 'type': 'text',
  455. 'name': '分润明细',
  456. 'code': 'fen_run'
  457. },
  458. ]
  459. },
  460. '-4': {
  461. operate: [
  462. // {
  463. // 'type': 'text',
  464. // 'name': '备注',
  465. // 'code': 'remark'
  466. // }, {
  467. // 'type': 'text',
  468. // 'name': '删除',
  469. // 'code': 'destroy'
  470. // }
  471. ]
  472. },
  473. '-5': {
  474. operate: [
  475. // {
  476. // 'type': 'text',
  477. // 'name': '备注',
  478. // 'code': 'remark'
  479. // }, {
  480. // 'type': 'text',
  481. // 'name': '删除',
  482. // 'code': 'destroy'
  483. // }
  484. ]
  485. },
  486. },
  487. repeal_list: {
  488. '1': '售后中',
  489. '2': '售后完成',
  490. },
  491. tabs: [
  492. {
  493. name: '全部',
  494. value: '999'
  495. },
  496. {
  497. name: '未付款',
  498. value: '0'
  499. },
  500. {
  501. name: '待服务',
  502. value: '2'
  503. },
  504. // {
  505. // name: '服务中',
  506. // value: '3'
  507. // },
  508. {
  509. name: '已完成',
  510. value: '4'
  511. },
  512. {
  513. name: '已关闭',
  514. value: '-4'
  515. },
  516. ],
  517. order_status_list: {
  518. '0': "待付款",
  519. '1': "已支付",
  520. '2': "待服务",
  521. '3': "服务中",
  522. '4': "已验收",
  523. '-4': "已关闭",
  524. '-2': "退款中",
  525. '-1': "售后申请"
  526. },
  527. payment_type_list: {
  528. '0': "在线支付",
  529. '1': "微信",
  530. '2': "支付宝",
  531. '3': "银联卡",
  532. '5': "余额支付",
  533. '7': "汇聚支付",
  534. '8': "汇聚快捷支付",
  535. '100': "线下支付"
  536. },
  537. shipping_type_list: {
  538. '1': "物流配送",
  539. '2': "买家自提",
  540. '3': "商家配送",
  541. '4': "本地配送"
  542. },
  543. selectList: [{
  544. value: 'order_sn',
  545. name: '订单号'
  546. }, ],
  547. keyword_1: '1',
  548. activeName: '999',
  549. list: [],
  550. export_list: {},
  551. listLoading: false,
  552. page: 1,
  553. pageCount: 0,
  554. mch_id: 0, // 这个地方不知道要怎么获取
  555. searchCats: [],
  556. datetime: [],
  557. search_data: { // 筛选条件
  558. order_status: null,
  559. cats: [],
  560. start: null,
  561. end: null,
  562. goods_id: null,
  563. order_no: null,
  564. type_value: null,
  565. type: null,
  566. order_id: 0,
  567. r: 'store/store-order/index',
  568. },
  569. isShowChangePrice: false,
  570. change_price_form: {
  571. detail: [],
  572. shipping_money: 0,
  573. },
  574. isShowChangeAddress: false,
  575. change_address_form: {},
  576. isShowChangeShipping: false,
  577. shipping_form: {},
  578. isShowRemark: false,
  579. remark_form: {},
  580. user_level: {},
  581. // loading
  582. changePriceLoading: false,
  583. remarkLoading: false,
  584. changeAddressLoading: false,
  585. changeShippingLoading: false,
  586. orderUrl: 'store/store-order/index',
  587. // export_url: 'store/store-order/index',
  588. checkedOrder: [], //选中的订单
  589. isIndeterminate: false,
  590. dialogTableVisible_fenRun: false,
  591. activeNames: 'commission',
  592. orderId: 0,
  593. fenRunData: [],
  594. changesShipping: 0,
  595. changeprice: 0,
  596. changeprice_status: false,
  597. };
  598. },
  599. mounted: function() {
  600. this.search_data.order_id = getQuery('order_id');
  601. this.getList(this.search_data);
  602. },
  603. computed: {
  604. show_clear_search_btn: function() {
  605. return !isEmpty(this.search_data.cats) || !isEmpty(this.search_data.start) ||
  606. !isEmpty(this.search_data.end) || !isEmpty(this.search_data.goods_id) ||
  607. !isEmpty(this.search_data.order_no) || !isEmpty(this.search_data.type) ||
  608. !isEmpty(this.search_data.type_value);
  609. }
  610. },
  611. updated: function() {
  612. // console.log('ssssss')
  613. },
  614. methods: {
  615. change(e, type) {
  616. this.$forceUpdate();
  617. },
  618. //修改商品价格
  619. sumChangePrice(data, value) {
  620. if (value && !isNaN(value)) {
  621. if (value) {
  622. var change_price = parseFloat(this.change_price_form.detail[data.$index].goods_price) + parseFloat(value);
  623. var changesShipping = this.change_price_form.shipping_money;
  624. if (this.changesShipping > 0) { //当运费有修改时去修改的值
  625. changesShipping = this.changesShipping;
  626. }
  627. if (!changesShipping) {
  628. changesShipping = 0;
  629. }
  630. var changeprice = 0;
  631. var new_pay_money = 0;
  632. for (var i = 0; i < this.change_price_form.detail.length; i++) {
  633. if (this.change_price_form.detail[i].adjust_money && !isNaN(this.change_price_form.detail[i].adjust_money)) {
  634. var value_data = value.split(".");
  635. if (value_data.length > 1) {
  636. if (value_data[1].length > 2) {
  637. this.change_price_form.detail[i].adjust_money = parseFloat(value).toFixed(2);
  638. }
  639. }
  640. changeprice = parseFloat(changeprice) + parseFloat(this.change_price_form.detail[i].adjust_money);
  641. }
  642. new_pay_money += parseFloat(this.change_price_form.detail[i].goods_price);
  643. }
  644. if (change_price < 0) {
  645. this.change_price_form.new_pay_money = parseFloat(new_pay_money + parseFloat(changesShipping)).toFixed(2);
  646. this.change_price_form.detail[data.$index].new_goods_price = parseFloat(this.change_price_form.detail[data.$index].goods_price);
  647. this.$message.error("单个商品支付金额不可以小于零");
  648. } else {
  649. this.change_price_form.new_pay_money = (new_pay_money + parseFloat(changeprice) + parseFloat(changesShipping)).toFixed(2);
  650. if (this.change_price_form.new_pay_money < 0.1) {
  651. this.$message.error("实付金额不可以小于0.1");
  652. return false;
  653. }
  654. this.changeprice_status = true;
  655. this.change_price_form.detail[data.$index].new_goods_price = parseFloat(this.change_price_form.detail[data.$index].goods_price) + parseFloat(value);
  656. }
  657. }
  658. }
  659. return value;
  660. },
  661. //修改邮费
  662. sumChangeShipping(value) { //change_price_form.detail shipping_money
  663. var changeprice = 0;
  664. var new_pay_money = 0;
  665. for (var i = 0; i < this.change_price_form.detail.length; i++) {
  666. if (this.change_price_form.detail[i].adjust_money && !isNaN(this.change_price_form.detail[i].adjust_money)) {
  667. changeprice = parseFloat(changeprice) + parseFloat(this.change_price_form.detail[i].adjust_money);
  668. }
  669. new_pay_money += parseFloat(this.change_price_form.detail[i].goods_price);
  670. }
  671. if (value && !isNaN(value)) {
  672. this.change_price_form.new_pay_money = (new_pay_money + parseFloat(value) + parseFloat(changeprice)).toFixed(2);
  673. this.changesShipping = parseFloat(value).toFixed(2);
  674. }
  675. },
  676. objectSpanMethod({
  677. row,
  678. column,
  679. rowIndex,
  680. columnIndex
  681. }) {
  682. if (columnIndex === 6) {
  683. console.log(rowIndex, 'rowIndex');
  684. if (rowIndex === 0) {
  685. return {
  686. rowspan: this.change_price_form.detail.length,
  687. colspan: 1
  688. };
  689. } else {
  690. return {
  691. rowspan: 0,
  692. colspan: 0
  693. };
  694. }
  695. }
  696. return {
  697. rowspan: 1,
  698. colspan: 1
  699. };
  700. },
  701. mouseOver(index, i) {
  702. // console.log(i)
  703. this.current = index
  704. this.detailIndex = i
  705. this.hidden = true
  706. },
  707. mouseLeave() {
  708. this.hidden = false
  709. },
  710. remark() { // 备注
  711. },
  712. changeTime(e) {
  713. // console.log(e)
  714. this.search_data.start = e[0]
  715. this.search_data.end = e[1]
  716. },
  717. handleClick(res) { //标签页切换
  718. if (this.search_data.status == this.activeName) return;
  719. this.search_data.order_status = this.activeName;
  720. this.page = 1;
  721. this.getList(this.search_data);
  722. },
  723. search() {
  724. this.page = 1;
  725. this.getList(this.search_data);
  726. },
  727. clearSearch() {
  728. this.search_data.cats = [];
  729. this.search_data.start = null;
  730. this.search_data.end = null;
  731. this.search_data.order_status = null;
  732. this.search_data.order_no = null;
  733. this.search_data.type = null;
  734. this.search_data.type_value = null;
  735. this.datetime = [];
  736. this.getList();
  737. },
  738. handleChangeAddress(data) {
  739. this.handle('change_address', data, true);
  740. },
  741. handleShipping(data) {
  742. this.handle('shipping', data, true);
  743. },
  744. handle(type, data = null, submit = false) {
  745. console.log(type)
  746. let id = data ? parseInt(data.id) : '';
  747. let url = 'store/store-order/operate';
  748. switch (type) {
  749. // 订单详情
  750. case 'detail':
  751. let params = {
  752. r: 'store/store-order/reserve-detail'
  753. };
  754. if (id) params = Object.assign(params, {
  755. id: id
  756. });
  757. navigateTo(params);
  758. break;
  759. // 删除订单
  760. case 'destroy':
  761. param = {
  762. id: data.id,
  763. type
  764. };
  765. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
  766. type: 'warning'
  767. }).then(() => {
  768. this.send('store/store-order/del', param)
  769. }).catch((err) => {})
  770. break;
  771. // 取消订单
  772. case 'cancel':
  773. param = {
  774. id: id
  775. };
  776. this.$confirm('确定关闭订单吗?', '警告', {
  777. type: 'warning'
  778. }).then(() => {
  779. this.send('store/store-order/close', param)
  780. }).catch((err) => {})
  781. break;
  782. // 支付订单
  783. case 'pay':
  784. param = {
  785. id: id
  786. };
  787. this.$confirm('确定付款吗?', '警告', {
  788. type: 'warning'
  789. }).then(() => {
  790. this.send('store/store-order/pay', param)
  791. }).catch((err) => {})
  792. break;
  793. // 修改价格
  794. case 'change_price':
  795. if (submit) {
  796. //检测每个商品修改价格不可以小于0和商品总价不可以小于0
  797. for (var i = 0; i < this.change_price_form.detail.length; i++) {
  798. var change_price = (parseFloat(this.change_price_form.detail[i].goods_price) + parseFloat(this.change_price_form.detail[i].adjust_money)).toFixed(2);
  799. if (change_price < 0) {
  800. this.$message.error('单个商品的减价值不可以大于商品实付金额');
  801. return false;
  802. }
  803. }
  804. if (this.change_price_form.new_pay_money < 0.1) {
  805. this.$message.error("实付金额不可以小于0.1");
  806. return false;
  807. }
  808. this.changePriceLoading = true;
  809. this.send('store/store-order/change-price', this.change_price_form, (resp) => {
  810. if (resp.code == 0) this.isShowChangePrice = false;
  811. });
  812. setTimeout(() => {
  813. this.changePriceLoading = false;
  814. }, 100);
  815. } else {
  816. this.isShowChangePrice = true;
  817. var objString = JSON.stringify(data);
  818. this.change_price_form = JSON.parse(objString);
  819. this.$set(this.change_price_form, 'new_pay_money', this.change_price_form.pay_money);
  820. for (var i = 0; i < this.change_price_form.detail.length; i++) {
  821. this.$set(this.change_price_form.detail[i], 'new_goods_price', this.change_price_form.detail[i].goods_price);
  822. this.$set(this.change_price_form.detail[i], 'new_adjust_money', this.change_price_form.detail[i].adjust_money);
  823. //his.change_price_form.detail[i].adjust_money = 0;
  824. var discount_money = (parseFloat(this.change_price_form.detail[i].price) * this.change_price_form.detail[i].num) - parseFloat(this.change_price_form.detail[i].goods_price);
  825. this.$set(this.change_price_form.detail[i], 'discount_sum', discount_money);
  826. }
  827. }
  828. break;
  829. // 修改收货地址
  830. case 'change_address':
  831. if (submit) {
  832. this.changeAddressLoading = true;
  833. this.send('store/store-order/change-address', data, (resp) => {
  834. if (resp.code == 0) this.isShowChangeAddress = false;
  835. });
  836. setTimeout(() => {
  837. this.changeAddressLoading = false;
  838. }, 100);
  839. } else {
  840. this.isShowChangeAddress = true
  841. var objString = JSON.stringify(data);
  842. this.change_address_form = JSON.parse(objString);
  843. }
  844. break;
  845. // 备注
  846. case 'remark':
  847. if (submit) {
  848. this.remarkLoading = true;
  849. this.send('store/store-order/remark', this.remark_form, (resp) => {
  850. if (resp.code == 0) this.isShowRemark = false;
  851. });
  852. setTimeout(() => {
  853. this.remarkLoading = false;
  854. }, 100);
  855. } else {
  856. this.isShowRemark = true
  857. var objString = JSON.stringify(data);
  858. this.remark_form = JSON.parse(objString);
  859. }
  860. break;
  861. // 物流发货
  862. case 'shipping':
  863. if (submit) {
  864. this.changeShippingLoading = true;
  865. this.send('store/store-order/shipping', data, (resp) => {
  866. if (resp.code == 0) this.isShowChangeShipping = false;
  867. });
  868. setTimeout(() => {
  869. this.changeShippingLoading = false;
  870. }, 100);
  871. } else {
  872. this.isShowChangeShipping = true
  873. var objString = JSON.stringify(data);
  874. this.shipping_form = JSON.parse(objString);
  875. }
  876. break;
  877. // 收货
  878. case 'take-delivery':
  879. param = {
  880. id: id
  881. };
  882. this.$confirm('确定收货吗?', '警告', {
  883. type: 'warning'
  884. }).then(() => {
  885. this.send('store/store-order/take-delivery', param)
  886. }).catch((err) => {})
  887. break;
  888. // 订单完成
  889. case 'sales':
  890. param = {
  891. id: id
  892. };
  893. this.$confirm('确定完成订单吗?', '警告', {
  894. type: 'warning'
  895. }).then(() => {
  896. this.send('store/store-order/sales-order', param)
  897. }).catch((err) => {})
  898. break;
  899. case 'fen_run':
  900. this.dialogTableVisible_fenRun = true;
  901. this.orderId = id;
  902. this.getCapitalLog(id, this.activeNames)
  903. break;
  904. case 'printer':
  905. param = {
  906. order_id: data.main_order_id
  907. };
  908. this.$confirm('确定打印?', '警告', {
  909. type: 'warning'
  910. }).then(() => {
  911. this.send('printer/default/printer', param)
  912. }).catch((err) => {
  913. })
  914. break;
  915. }
  916. },
  917. send(url, params, callback) {
  918. let self = this;
  919. request({
  920. params: {
  921. r: url,
  922. },
  923. method: 'post',
  924. data: params
  925. }).then(e => {
  926. if (e.data.code == 0) {
  927. self.$message.success(e.data.msg);
  928. self.getList(this.search_data);
  929. } else {
  930. self.$message.error(e.data.msg);
  931. }
  932. if (callback) callback(e.data);
  933. }).catch(e => {
  934. console.log(e);
  935. });
  936. },
  937. searchClick() {
  938. this.page = 1;
  939. this.getList();
  940. },
  941. pagination(currentPage) {
  942. let self = this;
  943. self.page = currentPage;
  944. self.getList(this.search_data);
  945. },
  946. // 获取订单列表
  947. getList(params = {}) {
  948. let self = this;
  949. let basic_params = {
  950. r: 'store/store-order/index',
  951. page: self.page,
  952. is_reserve: 1
  953. };
  954. params = Object.assign(basic_params, params);
  955. if (self.listLoading == false) {
  956. self.listLoading = true;
  957. request({
  958. params: params,
  959. method: 'get',
  960. }).then(e => {
  961. self.listLoading = false;
  962. if (e.data.code == 0) {
  963. self.list = e.data.data.list;
  964. self.marketing_type_map = e.data.data.marketing_type_map;
  965. this.export_list = e.data.data.export_list;
  966. self.pageCount = e.data.data.page_count;
  967. } else {
  968. self.$message.error(e.data.msg);
  969. }
  970. }).catch(e => {
  971. self.$message.error(e.data.msg);
  972. self.listLoading = false;
  973. });
  974. }
  975. },
  976. orderChange(val) {
  977. let checkedCount = val.length;
  978. this.checkAll = checkedCount == this.list.length;
  979. this.isIndeterminate = checkedCount > 0 && checkedCount < this.list.length;
  980. },
  981. allSelOrder(boo) {
  982. let ids = [];
  983. this.list.forEach(v => {
  984. ids.push(v.id);
  985. })
  986. this.checkedOrder = boo ? ids : [];
  987. this.isIndeterminate = false;
  988. },
  989. commissionHandleClick(tab, event) {
  990. console.log(this.activeNames);
  991. this.getCapitalLog(this.orderId, this.activeNames)
  992. },
  993. getCapitalLog(orderId, wallet_type) {
  994. request({
  995. params: {
  996. r: 'store/store-order/commission-and-score-list',
  997. order_id: orderId,
  998. wallet_type: wallet_type,
  999. },
  1000. method: 'get',
  1001. }).then(e => {
  1002. if (e.data.code == 0) {
  1003. this.fenRunData = e.data.data.list;
  1004. this.user_level = e.data.data.user_level;
  1005. } else {
  1006. self.$message.error(e.data.msg);
  1007. }
  1008. }).catch(e => {
  1009. console.log(e);
  1010. });
  1011. },
  1012. getOrderPrice(data) {
  1013. let text = '';
  1014. switch (data.marketing_type) {
  1015. case 'ScoreMall':
  1016. text = data.extra_info;
  1017. break;
  1018. default:
  1019. text = '¥' + data.goods_price;
  1020. }
  1021. return text;
  1022. },
  1023. orderTypeTabClick(tab,event){
  1024. if('rorder' == this.orderTypeTab) navigateTo({r:'store/store-order/reserve'});
  1025. if('gorder' == this.orderTypeTab) navigateTo({r:'store/store-order/index'});
  1026. },
  1027. }
  1028. });
  1029. </script>
  1030. <style>
  1031. .vue-line-clamp p {
  1032. line-height: 22px;
  1033. }
  1034. .demo-form-inline .el-select .el-input {
  1035. width: 100px;
  1036. }
  1037. /* 订单表格 start */
  1038. .width-pre10 {
  1039. width: 10%;
  1040. }
  1041. .width-50 {
  1042. width: 50px;
  1043. }
  1044. .width-400 {
  1045. width: 350px;
  1046. }
  1047. .order-table {
  1048. overflow-x: scroll;
  1049. }
  1050. .tab-title,
  1051. .tab-cont {
  1052. width: 100%;
  1053. min-width: 1290px;
  1054. font-size: 13px;
  1055. }
  1056. .tab-title {
  1057. padding: 20px 0;
  1058. }
  1059. .tab-title>li {
  1060. padding: 0 10px;
  1061. }
  1062. .tab-cont {
  1063. border: 1px solid #F2F2F2;
  1064. margin-bottom: 20px;
  1065. }
  1066. .tab-cont-row {
  1067. padding: 10px 0;
  1068. background-color: #F7F7F7;
  1069. }
  1070. .tab-cont-info {
  1071. height: 100px;
  1072. }
  1073. .tab-cont-info>li {
  1074. /* display: flex;
  1075. flex-direction: column;
  1076. justify-content: center; */
  1077. height: 100%;
  1078. padding: 16px 10px;
  1079. }
  1080. .tab-btns {
  1081. width: 320px;
  1082. margin-right: 20px;
  1083. }
  1084. .tab-goods-name {
  1085. margin: 0 10px;
  1086. }
  1087. .border-right {
  1088. border-right: 1px solid #f2f2f2;
  1089. }
  1090. .border-bottom {
  1091. border-bottom: 1px solid #f2f2f2;
  1092. }
  1093. .no-border-bottom {
  1094. border-bottom: none !important;
  1095. }
  1096. .cursor {
  1097. cursor: pointer;
  1098. }
  1099. .edit-icon {
  1100. color: #03c5ff;
  1101. cursor: pointer;
  1102. }
  1103. .popover-btn {
  1104. font-size: 12px;
  1105. padding: 0 10px;
  1106. border-right: 1px solid var(--primary, #03c5ff);
  1107. cursor: pointer;
  1108. display: inline-block;
  1109. line-height: 1;
  1110. color: #03c5ff;
  1111. }
  1112. .popover-btn:last-child {
  1113. border-right: none;
  1114. }
  1115. .width-s {
  1116. width: 250px;
  1117. }
  1118. .el-button--text {
  1119. padding: 0 !important;
  1120. }
  1121. .com-order-refund-status {
  1122. position: absolute;
  1123. bottom: 18px;
  1124. left: 0px;
  1125. height: 20px;
  1126. width: 50px;
  1127. background-color: #FF7171;
  1128. color: #fff;
  1129. text-align: center;
  1130. border-radius: 0 0 5px 5px;
  1131. font-size: 12px;
  1132. }
  1133. .fenRunData .el-dialog__body {
  1134. padding: 0px 10px 0 10px;
  1135. }
  1136. .change_price p {
  1137. padding: 5px;
  1138. font-size: 15px;
  1139. width: 200px;
  1140. }
  1141. .change_price {
  1142. width: 200px;
  1143. margin: 0px 0 0px 81%;
  1144. }
  1145. .change_price label {
  1146. float: left;
  1147. width: 100px;
  1148. text-align: right;
  1149. padding-right: 20px;
  1150. }
  1151. .change_formula {
  1152. float: left;
  1153. width: 300px;
  1154. color: #6c6969;
  1155. font-size: 12px;
  1156. }
  1157. /* 订单表格 end */
  1158. </style>