index.vue 42 KB

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