index.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <zj-tab-page ref="tabPage" :defaultActives="[{ key: 'list', label: $route.meta.title+'-列表', essential: true }]">
  3. <template slot-scope="{activeKey, data}">
  4. <div v-if="activeKey == 'list'" class="app-container">
  5. <div class="screen-container">
  6. <el-form ref="screenForm" :model="screenForm" label-width="70px" size="small" label-position="left">
  7. <el-row :gutter="20">
  8. <el-col :xs="24" :sm="12" :lg="6">
  9. <el-form-item label="订单号" prop="orderId">
  10. <el-input v-model="screenForm.orderId" placeholder="请输入订单号"></el-input>
  11. </el-form-item>
  12. </el-col>
  13. <el-col :xs="24" :sm="12" :lg="6">
  14. <el-form-item label="售后编号" prop="orderRefundId">
  15. <el-input v-model="screenForm.orderRefundId" placeholder="请输入售后编号"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :xs="24" :sm="12" :lg="6">
  19. <el-form-item label="会员昵称" prop="userName">
  20. <el-input v-model="screenForm.userName" placeholder="请输入会员昵称"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :xs="24" :sm="12" :lg="6">
  24. <el-form-item label="手机号" prop="phone">
  25. <el-input v-model="screenForm.phone" placeholder="请输入手机号"></el-input>
  26. </el-form-item>
  27. </el-col>
  28. <el-col :xs="24" :sm="12" :lg="6">
  29. <el-form-item label="网点名称" prop="websitId">
  30. <el-select v-model="screenForm.websitId" placeholder="全部" filterable>
  31. <el-option label="全部" value=""></el-option>
  32. <el-option :label="item.name" :value="item.id" v-for="(item, index) in websiteList" :key="index"></el-option>
  33. </el-select>
  34. </el-form-item>
  35. </el-col>
  36. <!-- <el-col :xs="24" :sm="12" :lg="6">-->
  37. <!-- <el-form-item label="当前状态" prop="orderStatus">-->
  38. <!-- <el-select v-model="screenForm.orderStatus" placeholder="全部">-->
  39. <!-- <el-option label="全部" value=""></el-option>-->
  40. <!-- <el-option :label="item.label" :value="item.value" v-for="(item, index) in screen_status" :key="index"></el-option>-->
  41. <!-- </el-select>-->
  42. <!-- </el-form-item>-->
  43. <!-- </el-col>-->
  44. <el-col :xs="24" :sm="12" :lg="6">
  45. <el-form-item label="申请时间" prop="createDate">
  46. <el-date-picker
  47. v-model="screenForm.createDate"
  48. type="datetimerange"
  49. value-format="yyyy-MM-dd HH:mm:ss"
  50. range-separator="至"
  51. start-placeholder="开始日期"
  52. end-placeholder="结束日期">
  53. </el-date-picker>
  54. </el-form-item>
  55. </el-col>
  56. <el-col :xs="24" :sm="12" :lg="6">
  57. <el-form-item label="处理时间" prop="examineDate">
  58. <el-date-picker
  59. v-model="screenForm.examineDate"
  60. type="datetimerange"
  61. value-format="yyyy-MM-dd HH:mm:ss"
  62. range-separator="至"
  63. start-placeholder="开始日期"
  64. end-placeholder="结束日期">
  65. </el-date-picker>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :xs="24" :sm="12" :lg="6" class="tr">
  69. <el-form-item label="">
  70. <el-button size="small" type="primary" @click="submitScreenForm">搜索</el-button>
  71. <el-button size="small" @click="resetScreenForm">清空</el-button>
  72. </el-form-item>
  73. </el-col>
  74. </el-row>
  75. </el-form>
  76. </div>
  77. <div class="tabs-container order-tabs-container clearfix">
  78. <div class="fl">
  79. <el-tabs v-model="tabCurrent" type="card" @tab-click="changeTabs">
  80. <el-tab-pane label="全部" name="ALL"></el-tab-pane>
  81. <el-tab-pane label="待商家处理" name="DSJCL"></el-tab-pane>
  82. <el-tab-pane label="待买家处理" name="DMJCL"></el-tab-pane>
  83. <el-tab-pane label="待商家收货" name="DSJSH"></el-tab-pane>
  84. <el-tab-pane label="已完成" name="OVER"></el-tab-pane>
  85. </el-tabs>
  86. </div>
  87. <div class="fr">
  88. <el-button v-if="$restrict('exp')" size="small" type="primary" @click="handleExport">导出报表</el-button>
  89. </div>
  90. </div>
  91. <div class="order-main-container">
  92. <div class="table-top">
  93. <el-row style="width:100%">
  94. <el-col :span="6"><span class="item product">商品信息</span></el-col>
  95. <el-col :span="3" style="text-align: right"><span class="item">单价(元)/数量</span></el-col>
  96. <el-col :span="3" style="text-align: center"><span class="item">买家信息</span></el-col>
  97. <el-col :span="3" style="text-align: center"><span class="item">订单金额</span></el-col>
  98. <el-col :span="3" style="text-align: center"><span class="item">退款金额</span></el-col>
  99. <el-col :span="3" style="text-align: center"><span class="item">维权类型/状态</span></el-col>
  100. <el-col :span="3" style="text-align: center"><span class="item">操作</span></el-col>
  101. </el-row>
  102. </div>
  103. <div class="order-item" v-for="(order, index) in dataList" :key="order.orderRefundId">
  104. <div class="order-top">
  105. <el-row>
  106. <el-col :xs="24" :sm="24" :lg="20">
  107. <span><b>售后编号</b>:{{order.orderRefundId}}</span>
  108. <span><b>申请时间</b>:{{order.createTime}}</span>
  109. <span><b>商户</b>:{{order.companyWechatName || '无'}}</span>
  110. <span><b>发货状态</b>:{{order.logisticsNo ? '已发货' : '未发货'}}</span>
  111. </el-col>
  112. <el-col :xs="24" :sm="24" :lg="4" style="text-align: right;">
  113. <el-link type="primary" v-if="$restrict('orderNote')" :underline="false" @click="showRemark(order)">订单备注</el-link>
  114. <el-link type="primary" v-if="$restrict('detail')" :underline="false" @click="showDetail(order.orderRefundId)">查看详情</el-link>
  115. <!-- <el-link type="primary" :underline="false" @click="queryWorkOrder(order.orderId)">订单工单</el-link> -->
  116. </el-col>
  117. </el-row>
  118. </div>
  119. <div class="order-content">
  120. <el-row style="width:100%">
  121. <el-col :span="9" style="height: 100%;">
  122. <div class="col-item-pro">
  123. <div v-if="order.examineStatus === 'FAIL'">
  124. <div v-for="orderItem in order.orderDetails" :key="orderItem.orderDetailId">
  125. <div class="pro-item">
  126. <div class="left">
  127. <div class="image">
  128. <img :src="orderItem.imgUrl" style="height:80px;width: 80px;">
  129. </div>
  130. <div class="main">
  131. <span>{{orderItem.goodsName}}</span>
  132. <span class="spec">{{orderItem.goodsSpecName}}-{{orderItem.goodsSpecValue}}</span>
  133. </div>
  134. </div>
  135. <div class="right">
  136. <span>¥{{orderItem.price}}</span>
  137. <span>x{{orderItem.num}}</span>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <div v-else>
  143. <div v-for="orderItem in order.orderDetails" :key="orderItem.orderDetailId">
  144. <div class="pro-item" v-if="orderItem.refund">
  145. <div class="left">
  146. <div class="image">
  147. <img :src="orderItem.imgUrl" style="height:80px;width: 80px;">
  148. </div>
  149. <div class="main">
  150. <span>{{orderItem.goodsName}}</span>
  151. <span class="spec" v-if="orderItem.goodsSpecName === '默认' && orderItem.goodsSpecValue === '默认'">默认</span>
  152. <span class="spec" v-else>{{orderItem.goodsSpecName}}-{{orderItem.goodsSpecValue}}</span>
  153. </div>
  154. </div>
  155. <div class="right">
  156. <span>¥{{orderItem.price}}</span>
  157. <span>x{{orderItem.refundNum}}</span>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. </el-col>
  164. <el-col :span="3" style="height: 100%;">
  165. <div class="col-item">
  166. <div>{{ order.userName }}</div>
  167. <div>{{ order.phone }}</div>
  168. </div>
  169. </el-col>
  170. <el-col :span="3" style="height: 100%;">
  171. <div class="col-item">
  172. <div class="totalprice">¥{{ order.payAmount }}</div>
  173. </div>
  174. </el-col>
  175. <el-col :span="3" style="height: 100%;">
  176. <div class="col-item">
  177. <div class="totalprice">¥{{ order.refundAmount }}</div>
  178. </div>
  179. </el-col>
  180. <el-col :span="3" style="height: 100%;">
  181. <div class="col-item">
  182. <div>{{order.refundType | REFUND_CURRENT_TYPE_FILTER}}</div>
  183. <div>{{ order.orderStatus | ORDER_REFUND_CURRENT_STATUS_FILTER }}</div>
  184. </div>
  185. </el-col>
  186. <el-col :span="3" style="height: 100%;">
  187. <div class="col-item">
  188. <div class="operate" v-if="order.orderStatus === 'DSJCL'">
  189. <div>
  190. <el-button v-if="$restrict('agree')" slot="reference" type="text" size="small" @click="changeExamineStatus(order.orderRefundId,'OK',order.refundType,order.orderId,1)">同意</el-button>
  191. </div>
  192. <div>
  193. <el-button v-if="$restrict('reject')" slot="reference" type="text" size="small" @click="changeExamineStatus(order.orderRefundId,'FAIL')">拒绝</el-button>
  194. </div>
  195. <div>
  196. <!-- toWorkOrderDetail(order.orderId) -->
  197. <el-button type="text" size="small" v-if="order.toWorkOrder && $restrict('workOrder_detail')" @click="queryWorkOrder(order.orderId)">查看工单</el-button>
  198. </div>
  199. </div>
  200. <div class="operate" v-if="order.orderStatus === 'DSJSH'">
  201. <div v-if="$restrict('confirmReceipt')">
  202. <el-popconfirm title="确定要收货吗?" @confirm="receiveProd(order.orderRefundId)">
  203. <el-button slot="reference" type="text" size="small">确认收货</el-button>
  204. </el-popconfirm>
  205. </div>
  206. <div v-if="order.logisticsNo && $restrict('viewLogistics')">
  207. <el-button type="text" size="small" @click="queryLogistics(order)">查看物流</el-button>
  208. </div>
  209. <div>
  210. <el-button type="text" size="small" v-if="order.toWorkOrder && $restrict('workOrder_detail')" @click="toWorkOrderDetail(order.orderId)">查看工单</el-button>
  211. </div>
  212. </div>
  213. <el-button type="text" size="small" v-if="order.refundType == 'REFUND_GOODS' && order.orderStatus == 'OVER'" @click="changeExamineStatus(order.orderRefundId,'OK','REFUND_GOODS_DETAIL',order.orderId,2);returnGoodsForm.refundMessage = order.refundMessage">查看退货信息</el-button>
  214. </div>
  215. </el-col>
  216. </el-row>
  217. </div>
  218. <div class="order-remark buyer" v-if="order.buyerMsg">买家留言:{{order.buyerMsg}}</div>
  219. <div class="order-remark saler" v-if="order.remark">商家备注:{{order.remark}}</div>
  220. </div>
  221. <div class="no-data" v-if="dataList.length <= 0">暂无订单</div>
  222. </div>
  223. <div class="pagination clearfix">
  224. <div class="fr">
  225. <el-pagination
  226. @size-change="handleSizeChange"
  227. @current-change="handleCurrentChange"
  228. :current-page="currentPage"
  229. :page-sizes="[10, 20, 30, 50]"
  230. :page-size="10"
  231. layout="total, sizes, prev, pager, next, jumper"
  232. :total="listTotal">
  233. </el-pagination>
  234. </div>
  235. </div>
  236. </div>
  237. <!-- 订单备注 -->
  238. <div v-if="activeKey == 'remark'" class="app-container">
  239. <el-input
  240. type="textarea"
  241. :autosize="{ minRows: 8, maxRows: 16}"
  242. placeholder="请输入备注内容"
  243. v-model="remark"
  244. maxlength="100"
  245. show-word-limit>
  246. </el-input>
  247. <div slot="footer" class="dialog-footer">
  248. <el-button type="primary" @click="saveRemark(data.removeTab)">保 存</el-button>
  249. <el-button @click="cancelRemark;data.removeTab()">取 消</el-button>
  250. </div>
  251. </div>
  252. <!-- 物流信息 -->
  253. <div v-if="activeKey == 'materialDetail'" class="app-container">
  254. <el-table
  255. :data="logistics"
  256. style="width: 100%"
  257. size="mini">
  258. <el-table-column prop="logisticsNo" label="快递单号" align="center"></el-table-column>
  259. <el-table-column prop="comName" label="物流公司" align="center"></el-table-column>
  260. <el-table-column prop="time" label="物流时间" align="center"></el-table-column>
  261. <el-table-column prop="state" label="物流状态" align="center">
  262. <template slot-scope="scope">
  263. {{ scope.row.state | EXPRESS_CURRENT_STATE_FILTER }}
  264. </template>
  265. </el-table-column>
  266. <el-table-column prop="context" label="物流详情" align="center"></el-table-column>
  267. </el-table>
  268. <div slot="footer" class="dialog-footer">
  269. <el-button @click="logisticsVisible = false;data.removeTab()">关 闭</el-button>
  270. </div>
  271. </div>
  272. <!-- 退货确认 -->
  273. <div v-if="activeKey == 'REFUND_GOODS' || activeKey == 'REFUND_GOODS_DETAIL'" class="app-container">
  274. <el-form :model="returnGoodsForm" :rules="returnGoodsFormRules" ref="returnGoodsForm" label-width="80px" label-position="left">
  275. <el-row :gutter="20">
  276. <el-col :span="24">
  277. <el-form-item label="卖家留言" prop="refundMessage">
  278. <el-input type="textarea" :rows="5" :disabled="activeKey == 'REFUND_GOODS_DETAIL'" v-model="returnGoodsForm.refundMessage" placeholder="请输入卖家留言"></el-input>
  279. </el-form-item>
  280. </el-col>
  281. <el-col :span="24">
  282. <el-card class="box-card">
  283. <el-tabs v-model="typeIndex">
  284. <el-tab-pane label="发货数量" name="1"></el-tab-pane>
  285. <el-tab-pane label="发货条码" name="2"></el-tab-pane>
  286. </el-tabs>
  287. <br/>
  288. <el-button size="small" v-show="typeIndex == 2 && activeKey == 'REFUND_GOODS'" type="primary" @click="addCode()">新增</el-button>
  289. <el-button size="small" v-show="typeIndex == 1 && activeKey == 'REFUND_GOODS'" type="primary" @click="handleDownload('导入条码模板')">导入条码模板下载</el-button>
  290. <div class="table">
  291. <!-- 发货数量 -->
  292. <el-form v-show="typeIndex == 1" ref="formData1" :model="formData1" label-width="0" size="small" label-position="left">
  293. <el-table :data="formData1.list" element-loading-text="Loading" border fit highlight-current-row stripe>
  294. <el-table-column prop="brandName" align="center" label="品牌"></el-table-column>
  295. <el-table-column prop="mainName" align="center" label="大类"></el-table-column>
  296. <el-table-column prop="smallName" align="center" label="小类"></el-table-column>
  297. <el-table-column prop="goodsName" align="center" label="商品名称"></el-table-column>
  298. <el-table-column prop="goodsMaterialSpecsName" align="center" label="规格型号"></el-table-column>
  299. <el-table-column prop="goodsMaterialUnit" align="center" label="单位">
  300. <template slot-scope="scope">
  301. {{scope.row.goodsMaterialUnit == 'C'?'整套':scope.row.goodsMaterialUnit == 'I'?"单个":''}}
  302. </template>
  303. </el-table-column>
  304. <el-table-column prop="num" align="center" label="数量"></el-table-column>
  305. <el-table-column prop="insideNum" align="center" label="内机数量"></el-table-column>
  306. <el-table-column prop="outNum" align="center" label="外机数量"></el-table-column>
  307. <el-table-column prop="partNum" align="center" label="配件数量"></el-table-column>
  308. <el-table-column prop="refundInsideCodeQty" align="center" label="导入内机条码数量" width="140"></el-table-column>
  309. <el-table-column prop="refundOutCodeQty" align="center" label="导入外机条码数量" width="140"></el-table-column>
  310. <el-table-column prop="refundPartsCodeQty" align="center" label="导入配件条码数量" width="140"></el-table-column>
  311. <el-table-column label="操作" align="center" width="140" fixed="right">
  312. <template slot-scope="scope" v-if="formType != 2 && joinCode && activeKey == 'REFUND_GOODS'">
  313. <el-upload
  314. action='_'
  315. :show-file-list='false'
  316. :http-request="importCode"
  317. >
  318. <el-button @click="orderDetailId = scope.row.orderDetailId" size="mini" type="text">导入条码</el-button>
  319. </el-upload>
  320. </template>
  321. </el-table-column>
  322. </el-table>
  323. </el-form>
  324. <!-- 发货条码 -->
  325. <el-form ref="formData2" :model="formData2">
  326. <el-table v-show="typeIndex == 2" :data="formData2.list" element-loading-text="Loading" border fit highlight-current-row stripe>
  327. <el-table-column label="品牌" align="center">
  328. <template slot-scope="scope">
  329. <el-form-item>
  330. <el-input type="text" v-model="scope.row.brandName" :disabled="true" placeholder="请输入"></el-input>
  331. </el-form-item>
  332. </template>
  333. </el-table-column>
  334. <el-table-column label="商品大类" align="center">
  335. <template slot-scope="scope">
  336. <el-form-item>
  337. <el-input type="text" v-model="scope.row.mainName" :disabled="true" placeholder="请输入"></el-input>
  338. </el-form-item>
  339. </template>
  340. </el-table-column>
  341. <el-table-column label="商品小类" align="center">
  342. <template slot-scope="scope">
  343. <el-form-item>
  344. <el-input type="text" v-model="scope.row.smallName" :disabled="true" placeholder="请输入"></el-input>
  345. </el-form-item>
  346. </template>
  347. </el-table-column>
  348. <el-table-column prop="" align="center" label="商品名称">
  349. <template slot-scope="scope">
  350. <el-form-item>
  351. <el-input type="text" v-model="scope.row.goodsMaterialName" :disabled="true" placeholder="请输入"></el-input>
  352. </el-form-item>
  353. </template>
  354. </el-table-column>
  355. <el-table-column label="规格型号" align="center">
  356. <template slot-scope="scope">
  357. <el-form-item :prop="'list.' + scope.$index + '.specs'" :rules="[{ required: true, message: `请选择规格型号`, trigger: 'blur' }]">
  358. <el-select v-model="scope.row.specs" @change="(e)=>{changeSpecs(e,scope.row)}" value-key="goodsMaterialSpecsName" :disabled="isEdit2 != scope.$index || formType == 2 || activeKey == 'REFUND_GOODS_DETAIL'" placeholder="请选择" style="width: 100%;">
  359. <el-option
  360. v-for="(item,ind) in formData1.list"
  361. :key="ind"
  362. :label="item.goodsMaterialSpecsName"
  363. :value="item">
  364. </el-option>
  365. </el-select>
  366. </el-form-item>
  367. </template>
  368. </el-table-column>
  369. <el-table-column label="物料类型" align="center">
  370. <template slot-scope="scope">
  371. <el-form-item :prop="'list.' + scope.$index + '.goodsMaterialItemType'" :rules="[{ required: true, message: `请选择物料类型`, trigger: 'blur' }]">
  372. <el-select v-model="scope.row.goodsMaterialItemType" @change="(e)=>{changeMaterial(e,scope.row)}"
  373. :disabled="isEdit2 != scope.$index || formType == 2 || activeKey == 'REFUND_GOODS_DETAIL'" placeholder="请选择" style="width: 100%;">
  374. <el-option
  375. v-for="(item,ind) in [{name: '内机',id: 'INSIDE'},{name: '外机',id: 'OUT'},{name: '配件',id: 'PARTS'}]"
  376. :key="ind"
  377. :label="item.name"
  378. :value="item.id">
  379. </el-option>
  380. </el-select>
  381. </el-form-item>
  382. </template>
  383. </el-table-column>
  384. <el-table-column label="物料名称" align="center">
  385. <template slot-scope="scope">
  386. <el-form-item :prop="'list.' + scope.$index + '.material'" :rules="[{ required: true, message: `请选择物料名称`, trigger: 'blur' }]">
  387. <el-select v-model="scope.row.material" @focus="(e)=>{
  388. if(!scope.row.goodsMaterialItemType){
  389. return this.$message.warning('请先选择物料类型!');
  390. }
  391. }" @change="(e)=>{
  392. scope.row.materialName = e.name
  393. scope.row.stockQty = (e.uniqueCode=='YES'?1:null)
  394. scope.row.uniqueCode = e.uniqueCode
  395. scope.row.goodsMaterialItemId = e.itemId
  396. }" value-key="name" :disabled="isEdit2 != scope.$index || formType == 2 || activeKey == 'REFUND_GOODS_DETAIL'" placeholder="请选择" style="width: 100%;">
  397. <el-option
  398. v-for="(item,ind) in scope.row.materialList"
  399. :key="ind"
  400. :label="item.name"
  401. :value="item">
  402. </el-option>
  403. </el-select>
  404. </el-form-item>
  405. </template>
  406. </el-table-column>
  407. <el-table-column prop="" align="center" label="是否一物一码" >
  408. <template slot-scope="scope">
  409. <el-form-item>
  410. {{scope.row.uniqueCode=='YES'?'是':scope.row.uniqueCode=='NO'?'否':''}}
  411. </el-form-item>
  412. </template>
  413. </el-table-column>
  414. <el-table-column prop="" align="center" label="条码" >
  415. <template slot-scope="scope">
  416. <el-form-item :prop="'list.' + scope.$index + '.materialCode'" :rules="[{ required: true, message: `请输入条码`, trigger: 'blur' }]">
  417. <el-input type="text" v-model="scope.row.materialCode" :disabled="isEdit2 != scope.$index || formType == 2 || activeKey == 'REFUND_GOODS_DETAIL'" placeholder="请输入"></el-input>
  418. </el-form-item>
  419. </template>
  420. </el-table-column>
  421. <el-table-column prop="" align="center" label="数量">
  422. <template slot-scope="scope">
  423. <el-form-item :prop="'list.' + scope.$index + '.stockQty'" :rules="[{ required: true, message: `请输入数量`, trigger: 'blur' }]">
  424. <el-input type="number" v-model="scope.row.stockQty" :disabled="isEdit2 != scope.$index || formType == 2 || activeKey == 'REFUND_GOODS_DETAIL' || scope.row.uniqueCode=='YES'" placeholder="请输入"></el-input>
  425. </el-form-item>
  426. </template>
  427. </el-table-column>
  428. <el-table-column label="操作" align="right" width="140" fixed="right">
  429. <template slot-scope="scope" v-if="formType != 2 && activeKey == 'REFUND_GOODS'">
  430. <el-button size="mini" type="primary" v-if="scope.$index == isEdit2" @click="saveCode(scope.row)">保存</el-button>
  431. <el-button size="mini" type="primary" v-if="scope.$index != isEdit2" @click="isEdit2 = scope.$index">编辑</el-button>
  432. <el-popconfirm title="确定删除吗?" @confirm="delCode(scope.row.orderDetailCodeId,scope.$index)">
  433. <el-button slot="reference" size="mini" type="danger">删除</el-button>
  434. </el-popconfirm>
  435. </template>
  436. </el-table-column>
  437. </el-table>
  438. </el-form>
  439. </div>
  440. </el-card>
  441. </el-col>
  442. </el-row>
  443. </el-form>
  444. <div slot="footer" class="dialog-footer">
  445. <el-button @click="returnGoodsVisible = false;data.removeTab()">关 闭</el-button>
  446. <el-button v-if="activeKey == 'REFUND_GOODS'" @click="saveReturnGoods(data.removeTab)">确 定</el-button>
  447. </div>
  448. </div>
  449. </template>
  450. </zj-tab-page>
  451. </template>
  452. <script>
  453. import {getRefundList, saveRefundRemark, changeExamineStatus, receiveProd, getWebsiteList, getOrderDetail, getCodeDetail2, getMaterialList, listImport2, saveCode2,delCode2} from "@/api/order"
  454. import {getExpress} from "@/api/common"
  455. import {downloadFiles} from '@/utils/util'
  456. import '@/styles/order-list.scss'
  457. export default {
  458. name: "order_refund",
  459. data() {
  460. return {
  461. screenForm: { // 筛选表单数据
  462. orderId: '', // 订单号
  463. orderRefundId: '', // 售后编号
  464. userName: '', // 会员昵称
  465. phone: '', // 手机号
  466. websitId: '', // 网点名称
  467. createDate: '', // 创建时间
  468. examineDate: '', // 支付时间
  469. orderStatus: '',
  470. },
  471. returnGoodsForm: {
  472. refundMessage: ''
  473. },
  474. tabCurrent: 'ALL',
  475. currentPage: 1, // 当前页码
  476. pageSize: 10, // 每页数量
  477. listTotal: 0, // 列表总数
  478. dataList: [],
  479. remarkVisible: false,
  480. editOrderId: '',
  481. remark: '', // 订单备注
  482. logisticsVisible: false,
  483. logistics: [],
  484. detail: {},
  485. websiteList: [],
  486. formType: 'add',
  487. formVisible: false,
  488. returnGoodsVisible: false,
  489. typeIndex: '1',
  490. formData1: {
  491. list: [],
  492. },
  493. formData2: {
  494. list: [],
  495. },
  496. isEdit1: 0,
  497. isEdit2: 0,
  498. joinCode: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
  499. orderDetailId: '',
  500. returnGoodsFormRules: {
  501. refundMessage: [{ required: true, message: '请填写卖家留言', trigger: 'blur' }],
  502. },
  503. }
  504. },
  505. created() {
  506. this.getList();
  507. this.getWebsiteList();
  508. if(this.$route.query.id){
  509. this.showDetail(this.$route.query.id)
  510. }
  511. },
  512. methods: {
  513. queryWorkOrder(id) {
  514. this.$router.push({
  515. name: 'workOrderPool',
  516. params: {
  517. pageName: id,
  518. pageType: 'saleOrderId',
  519. pageCode: id,
  520. },
  521. })
  522. },
  523. changeTabs(tab, event) {
  524. // this.$refs.screenForm.resetFields();
  525. this.screenForm.orderStatus = this.tabCurrent === 'ALL' ? '' : tab.$options.propsData.name
  526. this.currentPage = 1;
  527. this.getList();
  528. },
  529. // 获取数据列表
  530. getList () {
  531. this.listLoading = true;
  532. let pageData = {
  533. pageNum: this.currentPage,
  534. pageSize: this.pageSize
  535. }
  536. let screenData = {
  537. orderId: this.screenForm.orderId, // 订单号
  538. orderRefundId: this.screenForm.orderRefundId, // 售后编号
  539. userName: this.screenForm.userName, // 会员昵称
  540. phone: this.screenForm.phone, // 手机号
  541. websitId: this.screenForm.websitId,
  542. orderStatus: this.screenForm.orderStatus, // 状态
  543. startCreateTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '', // 创建时间
  544. endCreateTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '', // 创建时间
  545. startExamineTime: this.screenForm.examineDate ? this.screenForm.examineDate[0] : '', // 处理时间
  546. endExamineTime: this.screenForm.examineDate ? this.screenForm.examineDate[1] : '', // 处理时间
  547. };
  548. let params = {};
  549. Object.assign(params, screenData, pageData);
  550. getRefundList(params).then(res => {
  551. this.dataList = res.data.records;
  552. this.listTotal = res.data.total;
  553. this.listLoading = false;
  554. })
  555. },
  556. getOrderDetail(orderId){
  557. getOrderDetail({orderId}).then(res => {
  558. this.formData1.list = res.data.orderDetails
  559. })
  560. },
  561. async getCodeDetail2(){
  562. getCodeDetail2({orderId: this.editOrderId}).then(async res => {
  563. for(var item of res.data){
  564. item.specs = {goodsMaterialSpecsName: item.specsName}
  565. item.material = {name: item.materialName}
  566. item.materialList = await this.getMaterialList(item.specsName,item.goodsMaterialItemType)
  567. }
  568. this.formData2.list = res.data
  569. })
  570. },
  571. async getMaterialList(specsName,type){
  572. return new Promise((resolve, reject) => {
  573. getMaterialList({
  574. pageNum: 1,
  575. pageSize: -1,
  576. specsName,
  577. type
  578. }).then(async res => {
  579. resolve(res.data.records)
  580. })
  581. })
  582. },
  583. async changeSpecs(e,row){
  584. row.brandName = e.brandName
  585. row.brandId = e.brandId
  586. row.mainName = e.mainName
  587. row.mainId = e.mainNumber
  588. row.smallName = e.smallName
  589. row.smallId = e.smallNumber
  590. row.specsName = e.goodsMaterialSpecsName
  591. row.goodsMaterialName = e.goodsName
  592. row.goodsMaterialId = e.goodsMaterialId
  593. row.material = null
  594. row.materialName = ''
  595. row.stockQty = ''
  596. row.uniqueCode = ''
  597. row.materialList = await this.getMaterialList(row.specsName,row.goodsMaterialItemType)
  598. row.orderDetailId = e.orderDetailId
  599. },
  600. async changeMaterial(e,row){
  601. row.material = null
  602. row.materialName = ''
  603. row.stockQty = ''
  604. row.uniqueCode = ''
  605. row.materialList = await this.getMaterialList(row.specsName,row.goodsMaterialItemType)
  606. },
  607. //发货新增条码
  608. addCode(){
  609. this.$refs.formData2.validate((valid) => {
  610. if (valid) {
  611. this.isEdit2 = 0
  612. this.formData2.list.unshift({
  613. brandId: '',
  614. brandName: '',
  615. mainId: '',
  616. mainName: '',
  617. stockQty: '',
  618. smallId: '',
  619. smallName: '',
  620. goodsMaterialItemType: '',
  621. goodsMaterialName: '',
  622. goodsMaterialId: '',
  623. materialCode: '',
  624. uniqueCode: '',
  625. specs: null,
  626. specsName: '',
  627. materialName: '',
  628. material: null,
  629. materialList: [],
  630. orderDetailId: '',
  631. goodsMaterialItemId: ''
  632. })
  633. }
  634. });
  635. },
  636. delCode(orderDetailCodeId,index){
  637. if(orderDetailCodeId){
  638. delCode2({
  639. orderDetailCodeId
  640. }).then(res => {
  641. if (res.code == 200) {
  642. this.$message({ type: 'success', message: '删除成功!' })
  643. this.getOrderDetail()
  644. this.getCodeDetail2()
  645. } else {
  646. this.$message.error(res.msg);
  647. }
  648. })
  649. }else{
  650. this.formData2.list.splice(index,1)
  651. }
  652. },
  653. saveCode(orderDetailCodes){
  654. const that = this
  655. let params = [{
  656. ...orderDetailCodes,
  657. orderId: this.editOrderId,
  658. }]
  659. delete params[0].material;
  660. delete params[0].specs;
  661. this.$refs.formData2.validate((valid, invalidFields, errLabels) => {
  662. if (valid) {
  663. saveCode2(params).then(res=>{
  664. if(res.code == 200){
  665. that.$message.success('保存成功!')
  666. this.getOrderDetail()
  667. this.getCodeDetail2()
  668. }
  669. })
  670. }
  671. })
  672. },
  673. openForm(type,order){
  674. this.$refs.tabPage.addTab({
  675. // 对应显示的模块
  676. activeKey: type,
  677. // 唯一标识
  678. key: type,
  679. // 页签名称
  680. label: ({ remark: "订单备注", materialDetail: "查看物流", REFUND_GOODS: "退货确认", REFUND_GOODS_DETAIL: '查看退货信息' })[type],
  681. // 打开时事件
  682. triggerEvent: () => {
  683. this.$nextTick(()=>{
  684. this.formType = type
  685. this.formVisible = true
  686. if(type == 'remark'){
  687. this.remarkVisible = true
  688. this.editOrderId = order.orderRefundId
  689. this.remark = order.remark
  690. }
  691. if(type == 'materialDetail'){
  692. this.logisticsVisible = true
  693. getExpress({ logisticsNo: order.logisticsNo }).then(res => {
  694. this.logistics = res.data
  695. })
  696. }
  697. if(type == 'REFUND_GOODS'){
  698. this.returnGoodsVisible = true
  699. this.editOrderId = order.orderRefundId
  700. }
  701. })
  702. },
  703. // 关闭时事件
  704. closeEvent: () => {
  705. }
  706. })
  707. },
  708. // 查看详情
  709. queryDetail (orderRefundId) {
  710. },
  711. // 更改每页数量
  712. handleSizeChange(val) {
  713. this.pageSize = val;
  714. this.currentPage = 1;
  715. this.getList();
  716. },
  717. // 更改当前页
  718. handleCurrentChange(val) {
  719. this.currentPage = val;
  720. this.getList();
  721. },
  722. // 提交筛选表单
  723. submitScreenForm() {
  724. this.currentPage = 1;
  725. this.getList();
  726. },
  727. // 重置筛选表单
  728. resetScreenForm() {
  729. this.$refs.screenForm.resetFields();
  730. this.currentPage = 1;
  731. this.getList();
  732. },
  733. // 网点列表
  734. getWebsiteList() {
  735. getWebsiteList({
  736. pageNum: 1,
  737. pageSize: 1000,
  738. type: 'C'
  739. }).then(res => {
  740. this.websiteList = res.data;
  741. })
  742. },
  743. showRemark(order) {
  744. this.openForm('remark',order)
  745. },
  746. cancelRemark() {
  747. this.remarkVisible = false
  748. this.editOrderId = ''
  749. this.remark = ''
  750. },
  751. saveRemark(cancel) {
  752. const params = {
  753. orderRefundId: this.editOrderId,
  754. remark: this.remark
  755. }
  756. saveRefundRemark(params).then(() => {
  757. cancel('list')
  758. this.cancelRemark();
  759. this.getList();
  760. this.$successMsg('保存成功');
  761. })
  762. },
  763. saveReturnGoods(cancel){
  764. changeExamineStatus({
  765. orderRefundId: this.editOrderId,
  766. examineStatus: 'OK',
  767. refundMessage: this.returnGoodsForm.refundMessage
  768. }).then(() => {
  769. cancel('list')
  770. this.getList();
  771. this.$successMsg('操作成功');
  772. })
  773. },
  774. // 变更维权处理状态
  775. changeExamineStatus(orderRefundId, examineStatus, refundType, orderId, type) {
  776. if(refundType == 'REFUND_GOODS' || refundType == 'REFUND_GOODS_DETAIL'){
  777. this.getOrderDetail(orderId)
  778. this.getCodeDetail2(orderId)
  779. this.openForm(refundType,{orderRefundId})
  780. }else{
  781. this.$prompt('请输入卖家留言', examineStatus == 'OK' ? '同意':'拒绝', {
  782. confirmButtonText: '确定',
  783. cancelButtonText: '取消',
  784. }).then(({ value }) => {
  785. changeExamineStatus({
  786. orderRefundId,
  787. examineStatus,
  788. refundMessage: value
  789. }).then(() => {
  790. this.getList();
  791. this.$successMsg('操作成功');
  792. })
  793. }).catch(() => {});
  794. }
  795. },
  796. // 查看物流
  797. queryLogistics(order) {
  798. this.openForm('materialDetail',order)
  799. },
  800. // 查看详情
  801. showDetail(orderRefundId) {
  802. // let {href} = this.$router.resolve({path: `/order/order_refund_detail?orderRefundId=${orderRefundId}`});
  803. // window.open(href, '_blank');
  804. this.$router.push({
  805. name:"order_refund_detail",
  806. query: {
  807. orderRefundId
  808. }
  809. })
  810. },
  811. receiveProd(orderRefundId) {
  812. receiveProd({orderRefundId}).then(() => {
  813. this.getList();
  814. this.$successMsg('操作成功');
  815. })
  816. },
  817. // 查看工单
  818. toWorkOrderDetail(orderId) {
  819. // let {href} = this.$router.resolve({path: `/order/workOrder_detail?orderId=${orderId}`});
  820. // window.open(href, '_blank');
  821. this.$router.push({
  822. name:"workOrder_detail",
  823. query: {
  824. orderId
  825. }
  826. })
  827. },
  828. // 导出
  829. handleExport() {
  830. let screenData = {
  831. orderId: this.screenForm.orderId, // 订单号
  832. orderRefundId: this.screenForm.orderRefundId, // 售后编号
  833. userName: this.screenForm.userName, // 会员昵称
  834. phone: this.screenForm.phone, // 手机号
  835. websitId: this.screenForm.websitId,
  836. orderStatus: this.screenForm.orderStatus, // 状态
  837. startCreateTime: this.screenForm.createDate ? this.screenForm.createDate[0] : '', // 创建时间
  838. endCreateTime: this.screenForm.createDate ? this.screenForm.createDate[1] : '', // 创建时间
  839. startExamineTime: this.screenForm.examineDate ? this.screenForm.examineDate[0] : '', // 处理时间
  840. endExamineTime: this.screenForm.examineDate ? this.screenForm.examineDate[1] : '', // 处理时间
  841. pageNum: this.currentPage,
  842. pageSize: this.pageSize
  843. };
  844. downloadFiles('order/refund/downLoadExcel', screenData);
  845. },
  846. importCode(data){
  847. const loading = this.$loading({
  848. lock: true,
  849. text: '正在导入',
  850. spinner: 'el-icon-loading',
  851. background: 'rgba(0, 0, 0, 0.7)'
  852. })
  853. var formdata = new FormData()
  854. formdata.append('file', data.file)
  855. let params = {
  856. orderDetailId: this.orderDetailId
  857. }
  858. if (!!params) {
  859. for (const key in params) {
  860. if (Object.hasOwnProperty.call(params, key)) {
  861. formdata.append(key, params[key])
  862. }
  863. }
  864. }
  865. listImport2({ formdata })
  866. .then(res => {
  867. this.getOrderDetail()
  868. loading.close()
  869. this.$message({
  870. type: 'success',
  871. message: '导入成功!'
  872. })
  873. })
  874. .catch(err => {
  875. loading.close()
  876. this.$message({
  877. type: 'error',
  878. message: err.message || '导入失败'
  879. })
  880. })
  881. },
  882. // 下载导入模版
  883. handleDownload(title) {
  884. commonTemplateDownload({ name: '导入条码.xlsx' }, title).then(res => {
  885. this.$message({
  886. message: '下载成功',
  887. type: 'success'
  888. })
  889. }).catch(err => {
  890. this.$message.error('下载失败')
  891. })
  892. },
  893. }
  894. }
  895. </script>