index.php 53 KB

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