index.php 54 KB

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