platform-order.php 48 KB

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