reserve.php 55 KB

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