index.php 52 KB

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