index.php 50 KB

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