index.php 51 KB

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