reserve.php 54 KB

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