index.php 48 KB

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