index.vue 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476
  1. <template>
  2. <div class="app-container">
  3. <el-page-header @back="goBack" content="订单详情"></el-page-header>
  4. <div class="order-main">
  5. <el-row style="padding: 15px 15px 10px">
  6. <el-col :span="24">
  7. <div class="order-main-title">
  8. <span>订单编号:{{ orderDetail.orderId }}</span>
  9. <span>下单时间:{{ orderDetail.createTime }}</span>
  10. <span>商户:{{ orderDetail.companyWechatName || '无' }}</span>
  11. <!-- <span>网点:{{ orderDetail.websitName || '无' }}</span> -->
  12. <el-tag v-if="orderDetail.isOld == 'YES'">以旧换新</el-tag>
  13. <div class="fr">
  14. <el-link type="primary" :underline="false" @click="showDialog('remark')">订单备注</el-link>
  15. </div>
  16. </div>
  17. </el-col>
  18. </el-row>
  19. <div style="width: 100%; padding: 10px 15px 15px 15px">
  20. <el-row>
  21. <el-col :span="10">
  22. <div style="display: flex;">
  23. <div>
  24. <div class="order-main-status">
  25. <span>{{ orderDetail.orderStatus | ORDER_CURRENT_STATUS_FILTER }}</span>
  26. </div>
  27. <div class="order-main-opt-btn">
  28. <template v-if="orderDetail.orderStatus === 'NOPAY'">
  29. <el-popconfirm title="确定收款吗?" @confirm="confirmOrder">
  30. <el-button slot="reference" size="small">确认收款</el-button>
  31. </el-popconfirm>
  32. <el-button size="small" @click="showDialog('price')" style="margin-left: 10px;">修改价格</el-button>
  33. <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
  34. <el-button slot="reference" size="small" type="danger">取消订单</el-button>
  35. </el-popconfirm>
  36. </template>
  37. <template v-if="orderDetail.orderStatus === 'DFH'">
  38. <el-button size="small" type="primary" @click="showDialog('send')">发货</el-button>
  39. <el-popconfirm title="确定取消订单吗?" @confirm="cancelOrder" style="margin-left: 10px;">
  40. <el-button slot="reference" size="small" type="danger">取消订单</el-button>
  41. </el-popconfirm>
  42. </template>
  43. <!-- <el-button type="primary" size="small" @click="returnOrder()" v-if="(orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER')">发起退货</el-button> -->
  44. <template v-if="orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER'">
  45. <el-button size="small" @click="showDialog('query')">查看物流</el-button>
  46. </template>
  47. </div>
  48. </div>
  49. <el-table
  50. class="specTable"
  51. style="margin-left: 30px;"
  52. height="120px"
  53. :data="printList"
  54. element-loading-text="Loading"
  55. border
  56. highlight-current-row
  57. stripe>
  58. <el-table-column align="center" label="打印人" prop="createBy" min-width="120" show-overflow-tooltip></el-table-column>
  59. <el-table-column align="center" label="打印时间" prop="createTime" width="160"></el-table-column>
  60. </el-table>
  61. </div>
  62. </el-col>
  63. <el-col :span="14" style="padding-top: 10px;">
  64. <el-steps :active="orderDetail.orderStatus != 'CLOSE' ? curOrderStatus : -1" align-center>
  65. <el-step title="买家下单" :description="orderDetail.createTime"></el-step>
  66. <el-step title="买家付款" :description="orderDetail.payTime ? orderDetail.payTime : ''"></el-step>
  67. <el-step title="商家发货" :description="orderDetail.deliverTime ? orderDetail.deliverTime : ''"></el-step>
  68. <el-step title="交易成功" :description="orderDetail.overTime ? orderDetail.overTime : ''"></el-step>
  69. </el-steps>
  70. </el-col>
  71. </el-row>
  72. </div>
  73. </div>
  74. <div class="order-receive-info">
  75. <el-row :gutter="30">
  76. <el-col :xs="24" :sm="12" :lg="12">
  77. <div class="main-detail">
  78. <h3>订单信息</h3>
  79. <div class="item">
  80. <div class="label">收货人信息:</div>
  81. <div class="value">{{ orderDetail.receUserName }} ({{ orderDetail.recePhone }})</div>
  82. </div>
  83. <div class="item">
  84. <div class="label">收货人地址:</div>
  85. <div class="value">{{ orderDetail.province + orderDetail.city + orderDetail.area + orderDetail.street +
  86. orderDetail.receAddress + (orderDetail.houseNo || '') }}</div>
  87. </div>
  88. <div class="item">
  89. <div class="label">销售员信息:</div>
  90. <div class="value">{{ orderDetail.workerName }} ({{ orderDetail.workerPhone }})</div>
  91. </div>
  92. <div class="item">
  93. <div class="label">业务员信息:</div>
  94. <div class="value">{{ orderDetail.saleName }} ({{ orderDetail.saleMobile }})</div>
  95. </div>
  96. <div class="item">
  97. <div class="label">下单渠道:</div>
  98. <div class="value">{{ orderDetail.source }}</div>
  99. </div>
  100. <div class="item">
  101. <div class="label">支付方式:</div>
  102. <div class="value">{{ orderDetail.payType }}</div>
  103. </div>
  104. <div class="item">
  105. <div class="label">是否开票:</div>
  106. <div class="value">{{ orderDetail.tax ? '是' : '否' }}</div>
  107. </div>
  108. <div class="item" v-if="orderDetail.dispatchType">
  109. <div class="label">工单派单方式:</div>
  110. <div class="value">{{ orderDetail.dispatchType }}</div>
  111. </div>
  112. </div>
  113. </el-col>
  114. <el-col :xs="24" :sm="12" :lg="12" v-if="orderDetail.orderStatus === 'YFH' || orderDetail.orderStatus === 'OVER'">
  115. <div class="main-detail">
  116. <h3>物流信息</h3>
  117. <div class="item">
  118. <div class="label">快递单号:</div>
  119. <div class="value">{{ orderDetail.logisticsNo }}</div>
  120. </div>
  121. <div class="item">
  122. <div class="label">快递公司:</div>
  123. <div class="value">{{ orderDetail.companyName }}</div>
  124. </div>
  125. <div class="item">
  126. <div class="label">货件仓储:</div>
  127. <div class="value">{{ orderDetail.storageName }}</div>
  128. </div>
  129. </div>
  130. </el-col>
  131. </el-row>
  132. </div>
  133. <div v-if="orderDetail.orderOldProductDTOList && orderDetail.orderOldProductDTOList.length > 0" style="margin-bottom: 30px;">
  134. <h3>旧机信息</h3>
  135. <div class="order-detail">
  136. <!-- 回收 -->
  137. <el-table :data="orderDetail.orderOldProductDTOList" style="width: 100%;" size="small" border>
  138. <el-table-column prop="mainName" label="大类" align="center"></el-table-column>
  139. <el-table-column prop="smallName" label="小类" align="center"></el-table-column>
  140. <el-table-column prop="specName" label="型号" align="center"></el-table-column>
  141. <el-table-column prop="itemList" label="属性" align="center">
  142. <template slot-scope="scope">
  143. {{scope.row.itemList.map(o => o.dictName).join('、')}}
  144. </template>
  145. </el-table-column>
  146. <el-table-column prop="unit" label="单位" align="center">
  147. <template>台</template>
  148. </el-table-column>
  149. <el-table-column prop="num" label="数量" align="center"></el-table-column>
  150. <el-table-column prop="payAmount" label="旧机金额" align="center"></el-table-column>
  151. <el-table-column prop="yjhxDkFlag" label="支付方式" align="center">
  152. <template slot-scope="scope">
  153. {{ {1: '线上支付抵扣订单货款', 2: '仅线上展示旧机价值'}[scope.row.yjhxDkFlag] }}
  154. </template>
  155. </el-table-column>
  156. </el-table>
  157. </div>
  158. </div>
  159. <div v-if="compensateList.length > 0" style="margin-bottom: 30px;">
  160. <h3>理赔信息</h3>
  161. <div class="order-detail">
  162. <!-- 理赔表格 -->
  163. <el-table :data="compensateList" style="width: 100%;" size="small" border>
  164. <el-table-column prop="goodsName" label="理赔商品" align="center"></el-table-column>
  165. <el-table-column prop="num" label="理赔数量" align="center"></el-table-column>
  166. <el-table-column prop="createTime" label="理赔时间" align="center"></el-table-column>
  167. <el-table-column prop="refundAmount" label="理赔金额" align="center"></el-table-column>
  168. <el-table-column prop="operatorUser" label="操作人" align="center"></el-table-column>
  169. <el-table-column prop="remark" label="备注" align="center"></el-table-column>
  170. </el-table>
  171. </div>
  172. </div>
  173. <h3>商品信息</h3>
  174. <div class="order-detail" style="margin-bottom: 30px;">
  175. <!-- 订单表格 -->
  176. <el-table :data="orderDetail.orderDetails" style="width: 100%" border>
  177. <el-table-column label="商品信息" min-width="200">
  178. <template slot-scope="scope">
  179. <el-row>
  180. <el-col :span="6">
  181. <el-image style="width: 40px; height: 40px" :src="scope.row.imgUrl">
  182. <div slot="error" class="image-slot">
  183. <i class="el-icon-picture-outline"></i>
  184. </div>
  185. </el-image>
  186. </el-col>
  187. <el-col :span="18">
  188. <div><el-tag type="danger" effect="plain" size="mini" style="margin-right: 4px" v-if="scope.row.promotionFullPieceId">满件打折</el-tag>{{ scope.row.goodsName }}</div>
  189. </el-col>
  190. </el-row>
  191. </template>
  192. </el-table-column>
  193. <el-table-column prop="goodsSpecValue" label="规格" align="center">
  194. <template slot-scope="scope">
  195. {{scope.row.goodsSpecName}}{{scope.row.goodsSpecValue}}
  196. </template>
  197. </el-table-column>
  198. <el-table-column prop="price" label="单价" align="center"></el-table-column>
  199. <el-table-column prop="num" label="数量" align="center"></el-table-column>
  200. <el-table-column prop="sendStockNum" label="已发货数量" min-width="100" align="center"></el-table-column>
  201. <el-table-column prop="shareAmount" label="分销金额" align="center">
  202. <template slot-scope="scope">
  203. {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.shareAmount : '0' }}
  204. </template>
  205. </el-table-column>
  206. <el-table-column prop="discountAmount" label="优惠金额" align="center"></el-table-column>
  207. <!-- <el-table-column prop="zkAmount" label="折扣优惠" align="center"></el-table-column> -->
  208. <el-table-column prop="applyAmount" label="优惠价格申请" align="center" min-width="110"></el-table-column>
  209. <el-table-column prop="profitAmount" label="实际销售金额" align="center" min-width="110">
  210. <template slot-scope="scope">
  211. {{ orderDetail.workerId || orderDetail.promotionGroupUserId ? scope.row.profitAmount : scope.row.payAmount }}
  212. </template>
  213. </el-table-column>
  214. <el-table-column prop="payAmount" label="商品总金额" align="center" min-width="100"></el-table-column>
  215. <el-table-column prop="freight" label="运费" align="center"></el-table-column>
  216. <el-table-column prop="userRefundNum" label="用户维权数量" align="center" min-width="110"></el-table-column>
  217. <el-table-column prop="userRefundAmount" label="用户维权金额" align="center" min-width="110"></el-table-column>
  218. <el-table-column prop="refundNum" label="退款数量" align="center"></el-table-column>
  219. <el-table-column prop="refundAmount" label="退款金额" align="center"></el-table-column>
  220. <el-table-column prop="refundBy" label="退款人" align="center"></el-table-column>
  221. <el-table-column prop="refundTime" label="退款时间" align="center" min-width="160"></el-table-column>
  222. <el-table-column label="操作" align="center" width="160" v-if="orderDetail.orderStatus != 'CLOSE' && orderDetail.payTypeId == 'WECHAT'">
  223. <template slot-scope="scope">
  224. <!-- <el-button v-if="!~['TIMEOUT', 'CLOSE'].indexOf(orderDetail.orderStatus)" size="mini" type="primary"
  225. @click="handleRefund(scope.row)"
  226. :disabled="!orderDetail.refundAble || scope.row.refundNum >= scope.row.num">退款</el-button> -->
  227. <!-- <el-button v-if="!~['TIMEOUT'].indexOf(orderDetail.orderStatus)" size="mini"
  228. @click="handleCompensate(scope.row)">理赔</el-button> -->
  229. </template>
  230. </el-table-column>
  231. </el-table>
  232. </div>
  233. <div v-if="deliverList.length > 0" style="margin-bottom: 30px;">
  234. <h3>发货记录</h3>
  235. <div class="order-detail">
  236. <!-- 发货记录 -->
  237. <el-table :data="deliverList" style="width: 100%;" size="small" border>
  238. <el-table-column prop="deliveryId" align="center" label="发货单号" width="160"></el-table-column>
  239. <el-table-column prop="status" align="center" label="状态">
  240. <template slot-scope="scope">
  241. {{ {SEND: '已发货', REFUND: '已退货', PART_REFUND: '部分退货', REFUND_PRICE: '仅退款'}[scope.row.status] }}
  242. </template>
  243. </el-table-column>
  244. <el-table-column prop="sendNum" align="center" label="发货数量"></el-table-column>
  245. <el-table-column prop="refundNum" align="center" label="退货数量"></el-table-column>
  246. <el-table-column prop="num" align="center" label="订单数量"></el-table-column>
  247. <el-table-column prop="sendInsideCodeQty" align="center" label="内机数量"></el-table-column>
  248. <el-table-column prop="sendOutCodeQty" align="center" label="外机数量"></el-table-column>
  249. <el-table-column prop="sendPartsCodeQty" align="center" label="配件数量"></el-table-column>
  250. <el-table-column prop="storageStockName" align="center" label="发货仓库" width="100"></el-table-column>
  251. <el-table-column prop="pickType" align="center" label="发货方式">
  252. <template slot-scope="scope">
  253. {{scope.row.pickType == 'YES' ? '自提' : '快递物流'}}
  254. </template>
  255. </el-table-column>
  256. <el-table-column prop="logisticsNo" align="center" label="快递单号" width="100"></el-table-column>
  257. <el-table-column prop="companyName" align="center" label="物流公司" width="100"></el-table-column>
  258. <el-table-column prop="pickName" align="center" label="提货人"></el-table-column>
  259. <el-table-column prop="pickPhone" align="center" label="提货人电话" width="110"></el-table-column>
  260. <el-table-column align="center" prop="deliverTime" label="发货时间" min-width="160"></el-table-column>
  261. <el-table-column prop="createBy" align="center" label="操作人" width="140"></el-table-column>
  262. <el-table-column prop="createTime" align="center" label="操作时间" width="160"></el-table-column>
  263. <el-table-column align="center" label="操作" fixed="right">
  264. <template slot-scope="scope">
  265. <!-- <el-button v-if="!~['TIMEOUT', 'CLOSE'].indexOf(orderDetail.orderStatus)" size="mini" type="text"
  266. @click="handleRefund(scope.row)" :disabled="!orderDetail.refundAble || scope.row.refundNum >= scope.row.num">退款
  267. </el-button> -->
  268. <el-button type="text" size="small" @click="toDeliverDetail(scope.row.deliveryId)">详情</el-button>
  269. <el-button type="text" size="small" @click="returnOrder(scope.row.deliveryId)" v-if="!~['TIMEOUT', 'CLOSE'].indexOf(orderDetail.orderStatus) && scope.row.status == 'SEND'">发起退货</el-button>
  270. </template>
  271. </el-table-column>
  272. </el-table>
  273. </div>
  274. </div>
  275. <div class="order-detail">
  276. <div class="order-amount-info">
  277. <el-row>
  278. <el-col :span="19">
  279. <div style="width: 1px;height: 1px;"></div>
  280. </el-col>
  281. <el-col :span="5">
  282. <div style="padding-bottom: 10px;">商品总价:¥ {{ orderDetail.totalAmount }}</div>
  283. <div style="padding-bottom: 10px;">运费:¥ {{ orderDetail.freight }}</div>
  284. <div style="padding-bottom: 10px;" v-if="orderDetail.discountAmount">
  285. 优惠:¥ {{ orderDetail.discountAmount }}
  286. <span v-if="orderDetail.exchangeCode">(优惠码:{{ orderDetail.exchangeCode }})</span>
  287. <span v-if="orderDetail.promotionDiscountRate">({{ orderDetail.promotionDiscountRate * 10 }}折)</span>
  288. <span v-if="orderDetail.promotionFullPieceId">({{ orderDetail.promotionFullPieceRemark }})</span>
  289. </div>
  290. <div style="font-size: 14px;">
  291. <span style="padding-right: 15px;">实际收款</span><span style="color: red;font-size: 18px;">¥ {{
  292. orderDetail.payAmount }}</span>
  293. </div>
  294. </el-col>
  295. </el-row>
  296. </div>
  297. </div>
  298. <div class="order-evaluate-info" v-if="evaluateDetail">
  299. <div class="title">
  300. <div class="left">评价信息<span>{{ evaluateDetail.createTime }}</span></div>
  301. <div class="right">
  302. <span>是否客户端展示</span>
  303. <el-switch v-model="evaluateDetail.isShow" @change="changeShow"></el-switch>
  304. </div>
  305. </div>
  306. <div class="main">
  307. <div class="rate-list">
  308. <div style="display: flex; align-items: center; margin-bottom: 5px;">商品质量:<el-rate
  309. :value="evaluateDetail.commentGoods" disabled disabled-void-color="#DDDDDD"></el-rate></div>
  310. <div style="display: flex; align-items: center; margin-bottom: 5px;">服务质量:<el-rate
  311. :value="evaluateDetail.commentService" disabled disabled-void-color="#DDDDDD"></el-rate></div>
  312. <div style="display: flex; align-items: center;">配送质量:<el-rate :value="evaluateDetail.commentExpress" disabled
  313. disabled-void-color="#DDDDDD"></el-rate></div>
  314. </div>
  315. <div class="tag-list" v-if="orderDetail.orderCommentTags && orderDetail.orderCommentTags.length > 0">
  316. <el-tag v-for="(item, index) in orderDetail.orderCommentTags" :key="index">{{ item }}</el-tag>
  317. </div>
  318. </div>
  319. <div class="content">{{ evaluateDetail.content }}</div>
  320. <div class="img-list" v-if="orderDetail.orderCommentImgs && orderDetail.orderCommentImgs.length > 0">
  321. <el-image v-for="(item, index) in orderDetail.orderCommentImgs" :key="index" :src="item"
  322. :preview-src-list="orderDetail.orderCommentImgs" fit="cover"></el-image>
  323. </div>
  324. </div>
  325. <el-dialog :title="dialogTitle" :visible.sync="remarkVisible" :show-close="false" :width="dialogWidth"
  326. :close-on-click-modal="false">
  327. <el-form :model="orderForm" :rules="orderFormRules" ref="orderForm" v-if="curOpenDialogType !== 'query'"
  328. label-width="100px" label-position="left">
  329. <el-form-item prop="remark" v-if="curOpenDialogType === 'remark'">
  330. <el-input type="textarea" :autosize="{ minRows: 8, maxRows: 16 }" placeholder="请输入备注内容" v-model="remark"
  331. maxlength="100" show-word-limit>
  332. </el-input>
  333. </el-form-item>
  334. <el-form-item prop="payAmount" v-if="curOpenDialogType === 'price'">
  335. <el-input v-model="orderForm.payAmount" autocomplete="off" placeholder="请输入价格"></el-input>
  336. </el-form-item>
  337. <el-form-item label="收货人" prop="receUserName" v-if="curOpenDialogType === 'info'">
  338. <el-input v-model="orderForm.receUserName" autocomplete="off" placeholder="请输入收货人"></el-input>
  339. </el-form-item>
  340. <el-form-item label="收货电话" prop="recePhone" v-if="curOpenDialogType === 'info'">
  341. <el-input v-model="orderForm.recePhone" autocomplete="off" placeholder="请输入收货电话"></el-input>
  342. </el-form-item>
  343. <el-form-item label="收货地址" prop="receAddress" v-if="curOpenDialogType === 'info'">
  344. <el-input v-model="orderForm.receAddress" autocomplete="off" placeholder="请输入收货地址"></el-input>
  345. </el-form-item>
  346. <template v-if="curOpenDialogType === 'send'">
  347. <el-row :gutter="20">
  348. <el-col :span="6">
  349. <el-form-item label="发货方式" prop="pickType">
  350. <el-radio-group v-model="orderForm.pickType">
  351. <el-radio label="YES">自提/自送</el-radio>
  352. <el-radio label="NO">快递物流</el-radio>
  353. </el-radio-group>
  354. </el-form-item>
  355. </el-col>
  356. <el-col :span="6">
  357. <el-form-item v-if="orderForm.pickType == 'YES'" label="提货人" prop="pickName" :rules="[{ required: true, message: '提货人不能为空', trigger: 'blur' }]">
  358. <el-input v-model="orderForm.pickName" placeholder="请输入提货人"></el-input>
  359. </el-form-item>
  360. </el-col>
  361. <el-col :span="6">
  362. <el-form-item v-if="orderForm.pickType == 'YES'" label="提货人电话" prop="pickPhone" :rules="[{ required: true, message: '提货人电话不能为空', trigger: 'blur' },{ pattern:/^((1[3456789]\d{9}))$/, message: '电话号码格式不正确', trigger: 'blur' }]">
  363. <el-input v-model="orderForm.pickPhone" placeholder="请输入提货人电话"></el-input>
  364. </el-form-item>
  365. </el-col>
  366. <el-col :span="6">
  367. <el-form-item v-if="orderForm.pickType == 'NO'" label="快递单号" prop="logisticsNo">
  368. <el-input v-model="orderForm.logisticsNo" autocomplete="off" placeholder="请输入快递单号"></el-input>
  369. </el-form-item>
  370. </el-col>
  371. <el-col :span="6">
  372. <el-form-item v-if="orderForm.pickType == 'NO'" label="物流公司" prop="companyCode">
  373. <el-select v-model="orderForm.companyCode" placeholder="请选择物流公司" style="width: 100%;">
  374. <el-option :label="item.name" :value="item.code" v-for="(item, index) in companyList"
  375. :key="index"></el-option>
  376. </el-select>
  377. </el-form-item>
  378. </el-col>
  379. <el-col :span="6">
  380. <el-form-item label="仓储" prop="storageId">
  381. <el-select v-model="orderForm.storageId" placeholder="请选择仓储" @change="(e)=>{
  382. storageName = storageList.find(item => item.storageId == e).storageName
  383. getDetail()
  384. }" style="width: 100%;">
  385. <el-option :label="item.storageName" :value="item.storageId" v-for="(item, index) in storageList"
  386. :key="index"></el-option>
  387. </el-select>
  388. </el-form-item>
  389. </el-col>
  390. <el-col :span="6">
  391. <el-form-item label="是否派单" prop="workOrder">
  392. <el-radio-group v-model="orderForm.workOrder">
  393. <el-radio :label="true">是</el-radio>
  394. <el-radio :label="false">否</el-radio>
  395. </el-radio-group>
  396. </el-form-item>
  397. </el-col>
  398. <el-col :span="24">
  399. <el-card class="box-card">
  400. <el-tabs v-model="typeIndex">
  401. <el-tab-pane v-if="orderDetail.orderStatus != 'YFH' && orderDetail.orderStatus != 'OVER'" label="发货数量" name="1"></el-tab-pane>
  402. <el-tab-pane v-if="joinCode == 'CODE'" label="发货条码" name="2"></el-tab-pane>
  403. </el-tabs>
  404. <br/>
  405. <el-button size="small" v-show="typeIndex == 2 && joinCode == 'CODE'" type="primary" @click="addCode()">新增</el-button>
  406. <el-button size="small" v-show="typeIndex == 1 && joinCode == 'CODE'" type="primary" @click="handleDownload('导入条码模板')">导入条码模板下载</el-button>
  407. <div class="table">
  408. <!-- 发货数量 -->
  409. <el-form v-show="typeIndex == 1" ref="formData1" :model="formData1" label-width="0" size="small" label-position="left">
  410. <el-table :data="formData1.list" element-loading-text="Loading" border fit highlight-current-row stripe @selection-change="deliverSelectionChange">
  411. <el-table-column type="selection" width="40"></el-table-column>
  412. <el-table-column prop="brandName" align="center" label="品牌"></el-table-column>
  413. <el-table-column prop="mainName" align="center" label="大类"></el-table-column>
  414. <el-table-column prop="smallName" align="center" label="小类"></el-table-column>
  415. <el-table-column prop="goodsName" align="center" label="商品名称"></el-table-column>
  416. <el-table-column prop="goodsMaterialName" align="center" label="物料名称"></el-table-column>
  417. <el-table-column prop="goodsMaterialSpecsName" align="center" label="规格型号"></el-table-column>
  418. <el-table-column prop="goodsMaterialUnit" align="center" label="单位">
  419. <template slot-scope="scope">
  420. {{scope.row.goodsMaterialUnit == 'C'?'整套':scope.row.goodsMaterialUnit == 'I'?"单个":''}}
  421. </template>
  422. </el-table-column>
  423. <el-table-column prop="num" align="center" label="订单数量">
  424. <template slot-scope="scope">
  425. <el-input v-model="scope.row.num" placeholder="请输入" type="number"></el-input>
  426. </template>
  427. </el-table-column>
  428. <el-table-column prop="sendStockNum" align="center" label="发货数量"></el-table-column>
  429. <el-table-column v-if="joinCode != 'NO'" prop="" align="center" label="发货仓库">
  430. <template slot-scope="scope">
  431. {{storageName}}
  432. </template>
  433. </el-table-column>
  434. <el-table-column v-if="joinCode != 'NO'" prop="stockOnQty" align="center" label="发货仓库库存" width="100"></el-table-column>
  435. <el-table-column v-if="joinCode != 'NO'" prop="allStockQty" align="center" label="库存总数量" width="100"></el-table-column>
  436. <el-table-column prop="insideNum" align="center" label="内机数量"></el-table-column>
  437. <el-table-column prop="outNum" align="center" label="外机数量"></el-table-column>
  438. <el-table-column prop="partNum" align="center" label="配件数量"></el-table-column>
  439. <el-table-column prop="insideCodeQty" align="center" label="导入内机条码数量" width="140"></el-table-column>
  440. <el-table-column prop="outCodeQty" align="center" label="导入外机条码数量" width="140"></el-table-column>
  441. <el-table-column prop="partsCodeQty" align="center" label="导入配件条码数量" width="140"></el-table-column>
  442. <el-table-column label="操作" align="center" width="140" fixed="right">
  443. <template slot-scope="scope" v-if="joinCode == 'CODE'">
  444. <el-upload
  445. action='_'
  446. :show-file-list='false'
  447. :http-request="importCode"
  448. >
  449. <el-button @click="orderDetailId = scope.row.orderDetailId" size="mini" type="text">导入条码</el-button>
  450. </el-upload>
  451. </template>
  452. </el-table-column>
  453. </el-table>
  454. </el-form>
  455. <!-- 发货条码 -->
  456. <el-form ref="formData2" :model="formData2">
  457. <el-table v-show="typeIndex == 2" :data="formData2.list" element-loading-text="Loading" border fit highlight-current-row stripe>
  458. <el-table-column label="品牌" align="center">
  459. <template slot-scope="scope">
  460. <el-form-item>
  461. <el-input type="text" v-model="scope.row.brandName" :disabled="true" placeholder="请输入"></el-input>
  462. </el-form-item>
  463. </template>
  464. </el-table-column>
  465. <el-table-column label="商品大类" align="center">
  466. <template slot-scope="scope">
  467. <el-form-item>
  468. <el-input type="text" v-model="scope.row.mainName" :disabled="true" placeholder="请输入"></el-input>
  469. </el-form-item>
  470. </template>
  471. </el-table-column>
  472. <el-table-column label="商品小类" align="center">
  473. <template slot-scope="scope">
  474. <el-form-item>
  475. <el-input type="text" v-model="scope.row.smallName" :disabled="true" placeholder="请输入"></el-input>
  476. </el-form-item>
  477. </template>
  478. </el-table-column>
  479. <el-table-column prop="" align="center" label="商品名称">
  480. <template slot-scope="scope">
  481. <el-form-item>
  482. <el-input type="text" v-model="scope.row.goodsMaterialName" :disabled="true" placeholder="请输入"></el-input>
  483. </el-form-item>
  484. </template>
  485. </el-table-column>
  486. <el-table-column label="规格型号" align="center">
  487. <template slot-scope="scope">
  488. <el-form-item :prop="'list.' + scope.$index + '.specs'" :rules="[{ required: true, message: `请选择规格型号`, trigger: 'blur' }]">
  489. <el-select v-model="scope.row.specs" @change="(e)=>{changeSpecs(e,scope.row)}" value-key="orderDetailId" :disabled="isEdit2 != scope.$index" placeholder="请选择" style="width: 100%;">
  490. <el-option
  491. v-for="(item,ind) in formData1.list"
  492. :key="ind"
  493. :label="item.goodsMaterialSpecsName"
  494. :value="item">
  495. </el-option>
  496. </el-select>
  497. </el-form-item>
  498. </template>
  499. </el-table-column>
  500. <el-table-column label="物料类型" align="center">
  501. <template slot-scope="scope">
  502. <el-form-item :prop="'list.' + scope.$index + '.goodsMaterialItemType'" :rules="[{ required: true, message: `请选择物料类型`, trigger: 'blur' }]">
  503. <el-select v-model="scope.row.goodsMaterialItemType" @change="(e)=>{changeMaterial(e,scope.row)}"
  504. :disabled="isEdit2 != scope.$index" placeholder="请选择" style="width: 100%;">
  505. <el-option
  506. v-for="(item,ind) in [{name: '内机',id: 'INSIDE'},{name: '外机',id: 'OUT'},{name: '配件',id: 'PARTS'}]"
  507. :key="ind"
  508. :label="item.name"
  509. :value="item.id">
  510. </el-option>
  511. </el-select>
  512. </el-form-item>
  513. </template>
  514. </el-table-column>
  515. <el-table-column label="物料名称" align="center">
  516. <template slot-scope="scope">
  517. <el-form-item :prop="'list.' + scope.$index + '.material'" :rules="[{ required: true, message: `请选择物料名称`, trigger: 'blur' }]">
  518. <el-select v-model="scope.row.material" @focus="(e)=>{
  519. if(!scope.row.goodsMaterialItemType){
  520. return $message.warning('请先选择物料类型!');
  521. }
  522. }" @change="(e)=>{
  523. scope.row.materialName = e.name
  524. scope.row.stockQty = (e.uniqueCode=='YES'?1:null)
  525. scope.row.uniqueCode = e.uniqueCode
  526. scope.row.goodsMaterialItemId = e.itemId
  527. }" value-key="name" :disabled="isEdit2 != scope.$index" placeholder="请选择" style="width: 100%;">
  528. <el-option
  529. v-for="(item,ind) in scope.row.materialList"
  530. :key="ind"
  531. :label="item.name"
  532. :value="item">
  533. </el-option>
  534. </el-select>
  535. </el-form-item>
  536. </template>
  537. </el-table-column>
  538. <el-table-column prop="" align="center" label="是否一物一码" >
  539. <template slot-scope="scope">
  540. <el-form-item>
  541. {{scope.row.uniqueCode=='YES'?'是':scope.row.uniqueCode=='NO'?'否':''}}
  542. </el-form-item>
  543. </template>
  544. </el-table-column>
  545. <el-table-column prop="" align="center" label="条码" >
  546. <template slot-scope="scope">
  547. <el-form-item :prop="'list.' + scope.$index + '.materialCode'" :rules="[{ required: true, message: `请输入条码`, trigger: 'blur' }]">
  548. <el-input type="text" v-model="scope.row.materialCode" :disabled="isEdit2 != scope.$index" placeholder="请输入"></el-input>
  549. </el-form-item>
  550. </template>
  551. </el-table-column>
  552. <el-table-column prop="" align="center" label="数量">
  553. <template slot-scope="scope">
  554. <el-form-item :prop="'list.' + scope.$index + '.stockQty'" :rules="[{ required: true, message: `请输入数量`, trigger: 'blur' }]">
  555. <el-input type="number" v-model="scope.row.stockQty" :disabled="isEdit2 != scope.$index || scope.row.uniqueCode=='YES'" placeholder="请输入"></el-input>
  556. </el-form-item>
  557. </template>
  558. </el-table-column>
  559. <el-table-column label="操作" align="right" width="140" fixed="right">
  560. <template slot-scope="scope">
  561. <el-button size="mini" type="primary" v-if="scope.$index == isEdit2" @click="saveCode(scope.row)">保存</el-button>
  562. <el-button size="mini" type="primary" v-if="scope.$index != isEdit2" @click="isEdit2 = scope.$index">编辑</el-button>
  563. <el-popconfirm title="确定删除吗?" @confirm="delCode(scope.row.orderDetailCodeId,scope.$index)">
  564. <el-button slot="reference" size="mini" type="danger">删除</el-button>
  565. </el-popconfirm>
  566. </template>
  567. </el-table-column>
  568. </el-table>
  569. </el-form>
  570. </div>
  571. </el-card>
  572. </el-col>
  573. </el-row>
  574. </template>
  575. </el-form>
  576. <el-table v-loading="logisticsLoading" :data="logistics" style="width: 100%" size="mini"
  577. v-if="curOpenDialogType === 'query'">
  578. <el-table-column prop="comName" label="物流公司" align="center"></el-table-column>
  579. <el-table-column prop="areaName" label="地区名称" align="center"></el-table-column>
  580. <el-table-column prop="time" label="物流时间" align="center"></el-table-column>
  581. <el-table-column prop="state" label="物流状态" align="center">
  582. <template slot-scope="scope">
  583. {{ scope.row.state | EXPRESS_CURRENT_STATE_FILTER }}
  584. </template>
  585. </el-table-column>
  586. <el-table-column prop="context" label="物流详情" align="center"></el-table-column>
  587. </el-table>
  588. <div slot="footer" class="dialog-footer">
  589. <el-button type="primary" @click="saveForm" v-if="curOpenDialogType !== 'query' && curOpenDialogType !== 'send'">保 存</el-button>
  590. <el-button type="primary" @click="deliverGoods" v-if="curOpenDialogType == 'send'">发 货</el-button>
  591. <el-button @click="cancelForm">{{ curOpenDialogType === 'query' ? '关 闭' : '取 消' }}</el-button>
  592. </div>
  593. </el-dialog>
  594. <el-dialog title="理赔" :visible.sync="compensateFormVisible" width="30%" :close-on-click-modal="false">
  595. <el-form ref="compensateForm" :model="compensateForm" :rules="compensateFormRules" label-position="left">
  596. <el-form-item label="理赔数量" prop="num">
  597. <el-input v-model="compensateForm.num" autocomplete="off"></el-input>
  598. </el-form-item>
  599. <el-form-item label="理赔金额" prop="amount">
  600. <el-input v-model="compensateForm.amount" autocomplete="off"></el-input>
  601. </el-form-item>
  602. <el-form-item label="备注" prop="remark">
  603. <el-input v-model="compensateForm.remark" autocomplete="off" type="textarea" :rows="3"></el-input>
  604. </el-form-item>
  605. </el-form>
  606. <div slot="footer" class="dialog-footer">
  607. <el-button @click="cancelCompensateForm">取 消</el-button>
  608. <el-button type="primary" @click="submitCompensateForm">确 定</el-button>
  609. </div>
  610. </el-dialog>
  611. </div>
  612. </template>
  613. <script>
  614. import {
  615. cancelOrder,
  616. changePrice,
  617. changeReceiveInfo,
  618. confirmOrder,
  619. getOrderDetail, orderDeliver,
  620. saveRemark, orderRefund, orderCompensate, getCompensateList,
  621. changeShow, getCodeDetail, getMaterialList, listImport, saveCode, delCode, getPrintList, getDeliverList
  622. } from "@/api/order";
  623. import { getExpress, getCompanyList } from "@/api/common";
  624. import { commonTemplateDownload } from '@/api/common.js'
  625. import * as Storage from "@/api/storage";
  626. import { mapGetters } from 'vuex'
  627. export default {
  628. name: "detail",
  629. data() {
  630. return {
  631. orderId: '',
  632. orderDetail: {},
  633. evaluateDetail: null,
  634. dialogTitle: '',
  635. remarkVisible: false,
  636. remark: '',
  637. price: 0,
  638. orderForm: {
  639. orderId: '',
  640. payAmount: '',
  641. receAddress: '',
  642. receUserName: '',
  643. recePhone: '',
  644. logisticsNo: '',
  645. companyCode: '',
  646. workOrder: true,
  647. pickType: 'YES',
  648. pickName: '',
  649. pickPhone: ''
  650. },
  651. orderFormRules: {
  652. payAmount: [
  653. {
  654. validator: (rule, value, callback) => {
  655. if (this.curOpenDialogType !== 'price') {
  656. callback()
  657. } else {
  658. if (!value) {
  659. callback(new Error('请输入价格'))
  660. } else {
  661. if (!this.isNumber(value)) {
  662. callback(new Error('请输入数字值'))
  663. } else {
  664. callback()
  665. }
  666. }
  667. }
  668. }, trigger: 'blur'
  669. }
  670. ],
  671. receUserName: [
  672. { require: true, message: '请输入收货人', trigger: 'blur' }
  673. ],
  674. recePhone: [
  675. { require: true, message: '请输入收货电话', trigger: 'blur' }
  676. ],
  677. receAddress: [
  678. { require: true, message: '请输入收货地址', trigger: 'blur' }
  679. ],
  680. logisticsNo: [
  681. {
  682. validator: (rule, value, callback) => {
  683. if (this.curOpenDialogType !== 'send') {
  684. callback()
  685. } else {
  686. if (!value) {
  687. callback(new Error('请输入快递单号'))
  688. } else {
  689. callback()
  690. }
  691. }
  692. }, trigger: 'blur'
  693. }
  694. ],
  695. storageId: [
  696. {
  697. validator: (rule, value, callback) => {
  698. let joinCode = JSON.parse(localStorage.getItem('greemall_user')).joinCode;
  699. if (this.curOpenDialogType !== 'send' || joinCode == 'NO') {
  700. callback()
  701. } else {
  702. if (!value) {
  703. callback(new Error('请选择仓储'))
  704. } else {
  705. callback()
  706. }
  707. }
  708. }, trigger: 'change'
  709. }
  710. ],
  711. companyCode: [
  712. {
  713. validator: (rule, value, callback) => {
  714. if (this.curOpenDialogType !== 'send') {
  715. callback()
  716. } else {
  717. if (!value) {
  718. callback(new Error('请选择快递公司'))
  719. } else {
  720. callback()
  721. }
  722. }
  723. }, trigger: 'change'
  724. }
  725. ]
  726. },
  727. curOpenDialogType: 'order',
  728. logistics: [],
  729. storageList: [],
  730. dialogWidth: '50%',
  731. logisticsLoading: false,
  732. companyList: [],
  733. compensateFormVisible: false,
  734. compensateForm: {
  735. id: null,
  736. num: '',
  737. amount: '',
  738. remark: '',
  739. },
  740. compensateFormRules: {
  741. num: [
  742. { required: true, message: '请输入理赔数量', trigger: 'blur' },
  743. {
  744. validator: (rule, value, callback) => {
  745. if (value > (this.compensateItem.num - this.compensateItem.refundNum)) {
  746. callback(new Error('最多还可以理赔' + (this.compensateItem.num - this.compensateItem.refundNum) + '件商品'));
  747. } else {
  748. callback();
  749. }
  750. }, trigger: 'blur'
  751. }
  752. ],
  753. amount: [
  754. { required: true, message: '请输入理赔金额', trigger: 'blur' },
  755. ]
  756. },
  757. compensateItem: {
  758. num: '',
  759. refundNum: '',
  760. },
  761. compensateList: [],
  762. typeIndex: '1',
  763. formData1: {
  764. list: [],
  765. },
  766. formData2: {
  767. list: [],
  768. },
  769. isEdit1: 0,
  770. isEdit2: 0,
  771. joinCode: JSON.parse(localStorage.getItem('greemall_user')).joinCode,
  772. orderDetailId: '',
  773. printList: [],
  774. deliverList: [],
  775. deliverSelection: [],
  776. storageName: ''
  777. }
  778. },
  779. created() {
  780. this.orderId = this.$route.query.orderId
  781. this.getDetail();
  782. this.getStorageList();
  783. this.getCompanyList();
  784. this.getCompensateList();
  785. this.getPrintList();
  786. this.getDeliverList();
  787. },
  788. methods: {
  789. getDetail() {
  790. getOrderDetail({ orderId: this.orderId,storageId: this.orderForm.storageId }).then((res) => {
  791. this.orderDetail = res.data
  792. this.orderDetail.workerName = this.orderDetail.workerName ? this.orderDetail.workerName : '暂无'
  793. this.orderDetail.workerPhone = this.orderDetail.workerPhone ? this.orderDetail.workerPhone : ''
  794. this.evaluateDetail = res.data.orderComment;
  795. let arr = []
  796. res.data.orderDetails.forEach(item=>{
  797. arr.push(item)
  798. // if(item.goodsMaterialId){
  799. // arr.push(item)
  800. // }
  801. })
  802. this.formData1.list = arr
  803. })
  804. },
  805. getDeliverList() {
  806. getDeliverList({
  807. pageNum: 1,
  808. pageSize: -1,
  809. params: [{param: 'a.order_id', compare: '=', value: this.orderId}]
  810. }).then(res => {
  811. this.deliverList = res.data.records;
  812. })
  813. },
  814. getPrintList() {
  815. getPrintList({ orderId: this.orderId }).then(res => {
  816. this.printList = res.data || [];
  817. })
  818. },
  819. showDialog(type) {
  820. this.dialogWidth = type === 'query' ? '80%' : type === 'send' ? '80%': '50%'
  821. this.remarkVisible = true
  822. this.curOpenDialogType = type
  823. if (type === 'remark') {
  824. this.dialogTitle = '订单备注'
  825. this.remark = this.orderDetail.remark
  826. } else if (type === 'price') {
  827. this.dialogTitle = '修改价格'
  828. this.orderForm.payAmount = this.orderDetail.payAmount
  829. } else if (type === 'info') {
  830. this.dialogTitle = '收货人信息'
  831. this.orderForm.receUserName = this.orderDetail.receUserName
  832. this.orderForm.recePhone = this.orderDetail.recePhone
  833. this.orderForm.receAddress = this.orderDetail.receAddress
  834. } else if (type === 'send') {
  835. this.dialogTitle = '发货信息'
  836. } else if (type === 'query') {
  837. this.logisticsLoading = true
  838. this.dialogTitle = '物流信息'
  839. getExpress({
  840. logisticsNo: this.orderDetail.logisticsNo,
  841. companyCode: this.orderDetail.companyCode
  842. }).then(res => {
  843. this.logistics = res.data
  844. this.logisticsLoading = false
  845. })
  846. }
  847. },
  848. cancelForm() {
  849. this.remarkVisible = false
  850. if (this.curOpenDialogType === 'query') {
  851. return
  852. }
  853. this.$refs.orderForm.resetFields()
  854. if (this.curOpenDialogType === 'remark') {
  855. this.remark = ''
  856. } else if (this.curOpenDialogType === 'price') {
  857. this.price = ''
  858. }
  859. },
  860. saveForm() {
  861. const params = {
  862. orderId: this.orderId
  863. }
  864. if (this.curOpenDialogType === 'remark') {
  865. params.remark = this.remark
  866. saveRemark(params).then(() => {
  867. this.cancelForm();
  868. this.getDetail();
  869. this.$successMsg('保存成功');
  870. })
  871. } else if (this.curOpenDialogType === 'price') {
  872. params.price = this.orderForm.payAmount
  873. this.$refs.orderForm.validate((valid) => {
  874. if (valid) {
  875. changePrice(params).then(() => {
  876. this.cancelForm();
  877. this.getDetail();
  878. this.$successMsg('保存成功');
  879. })
  880. }
  881. })
  882. } else if (this.curOpenDialogType === 'info') {
  883. params.receUserName = this.orderForm.receUserName
  884. params.recePhone = this.orderForm.recePhone
  885. params.receAddress = this.orderForm.receAddress
  886. params.orderStatus = this.orderDetail.orderStatus
  887. this.$refs.orderForm.validate((valid) => {
  888. if (valid) {
  889. changeReceiveInfo(params).then(() => {
  890. this.cancelForm();
  891. this.getDetail();
  892. this.$successMsg('保存成功');
  893. })
  894. }
  895. })
  896. } else if (this.curOpenDialogType === 'send') {
  897. params.logisticsNo = this.orderForm.logisticsNo
  898. params.storageId = this.orderForm.storageId
  899. params.companyCode = this.orderForm.companyCode
  900. params.workOrder = this.orderForm.workOrder
  901. this.$refs.orderForm.validate((valid) => {
  902. if (valid) {
  903. orderDeliver(params).then(() => {
  904. this.cancelForm();
  905. this.getDetail();
  906. this.$successMsg('保存成功');
  907. })
  908. }
  909. })
  910. }
  911. },
  912. cancelOrder() {
  913. cancelOrder({ orderId: this.orderId }).then(() => {
  914. this.getDetail();
  915. this.$successMsg('取消成功');
  916. })
  917. },
  918. confirmOrder() {
  919. confirmOrder({ orderId: this.orderId }).then(() => {
  920. this.getDetail();
  921. this.$successMsg('确认收款成功');
  922. })
  923. },
  924. toDeliverDetail(deliveryId) {
  925. this.$router.push({
  926. name: "sales_deliver_order_list",
  927. query: {
  928. deliverId: deliveryId
  929. }
  930. })
  931. },
  932. // 发起退货
  933. returnOrder(deliveryId) {
  934. this.$router.push({
  935. name: "sales_return_order_list",
  936. query: {
  937. deliverId: deliveryId
  938. }
  939. })
  940. },
  941. goBack() {
  942. // this.$router.go(-1);
  943. this.$router.push({
  944. name:"order_list"
  945. })
  946. },
  947. isNumber(val) {
  948. const regPos = /^\d+(\.\d+)?$/
  949. const regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/
  950. if (regPos.test(val) || regNeg.test(val)) {
  951. return true
  952. } else {
  953. return false
  954. }
  955. },
  956. getStorageList() {
  957. Storage.getList({ pageNum: 1, pageSize: -1, type: '商品' }).then(res => {
  958. this.storageList = res.data.records
  959. })
  960. },
  961. // 获取物流公司列表
  962. getCompanyList() {
  963. getCompanyList().then(res => {
  964. this.companyList = res.data;
  965. })
  966. },
  967. // 退款
  968. handleRefund(row) {
  969. console.log(row);
  970. if (row.num == 1) {
  971. this.$confirm('此操作将退款此商品, 是否继续?', '退款', {
  972. confirmButtonText: '确定',
  973. cancelButtonText: '取消',
  974. type: 'warning'
  975. }).then(() => {
  976. this.orderRefund(1, row.orderDetailId);
  977. }).catch(() => { });
  978. }
  979. else {
  980. this.$prompt('请输入退款数量', '退款', {
  981. confirmButtonText: '确定',
  982. cancelButtonText: '取消',
  983. inputValidator: function (value) {
  984. if (!value) return '请输入退款数量';
  985. if (value == 0) return '退款数量不能小于1';
  986. if (value > (row.num - row.refundNum)) {
  987. return '最多还可以退款' + (row.num - row.refundNum) + '件商品'
  988. }
  989. },
  990. }).then(({ value }) => {
  991. this.orderRefund(value, row.orderDetailId);
  992. }).catch(() => { });
  993. }
  994. },
  995. // 退款
  996. orderRefund(num, id) {
  997. orderRefund({
  998. num: num,
  999. orderDetailId: id,
  1000. }).then(res => {
  1001. this.getDetail();
  1002. this.$successMsg('退款成功');
  1003. })
  1004. },
  1005. // 理赔
  1006. handleCompensate(row) {
  1007. this.compensateFormVisible = true;
  1008. this.compensateForm.id = row.orderDetailId;
  1009. this.compensateItem.num = row.num;
  1010. this.compensateItem.refundNum = row.refundNum;
  1011. },
  1012. // 取消 理赔
  1013. cancelCompensateForm() {
  1014. this.compensateFormVisible = false;
  1015. this.compensateForm = {
  1016. id: null,
  1017. num: '',
  1018. amount: '',
  1019. remark: '',
  1020. }
  1021. },
  1022. // 提交 理赔
  1023. submitCompensateForm() {
  1024. this.$refs.compensateForm.validate((valid) => {
  1025. if (valid) {
  1026. let params = {
  1027. adminUserId: this.userid,
  1028. orderDetailId: this.compensateForm.id,
  1029. num: this.compensateForm.num,
  1030. refundAmount: this.compensateForm.amount,
  1031. remark: this.compensateForm.remark,
  1032. }
  1033. orderCompensate(params).then(res => {
  1034. this.cancelCompensateForm();
  1035. this.getDetail();
  1036. this.getCompensateList();
  1037. this.$successMsg('理赔成功');
  1038. })
  1039. }
  1040. });
  1041. },
  1042. // 获取理赔列表
  1043. getCompensateList() {
  1044. getCompensateList({ orderId: this.orderId }).then(res => {
  1045. this.compensateList = res.data;
  1046. })
  1047. },
  1048. // 切换评价信息是否显示
  1049. changeShow() {
  1050. changeShow({
  1051. isShow: this.evaluateDetail.isShow,
  1052. orderId: this.orderId,
  1053. }).then(res => {
  1054. this.getDetail();
  1055. this.$successMsg();
  1056. })
  1057. },
  1058. async getCodeDetail(){
  1059. getCodeDetail({orderId: this.orderId}).then(async res => {
  1060. for(var item of res.data){
  1061. item.specs = {goodsMaterialSpecsName: item.specsName,orderDetailId: item.orderDetailId}
  1062. item.material = {name: item.materialName}
  1063. item.materialList = await this.getMaterialList(item.specsName,item.goodsMaterialItemType)
  1064. }
  1065. this.formData2.list = res.data
  1066. })
  1067. },
  1068. async getMaterialList(specsName,type){
  1069. return new Promise((resolve, reject) => {
  1070. getMaterialList({
  1071. pageNum: 1,
  1072. pageSize: -1,
  1073. specsName,
  1074. type
  1075. }).then(async res => {
  1076. resolve(res.data.records)
  1077. })
  1078. })
  1079. },
  1080. async changeSpecs(e,row){
  1081. row.brandName = e.brandName
  1082. row.brandId = e.brandId
  1083. row.mainName = e.mainName
  1084. row.mainId = e.mainNumber
  1085. row.smallName = e.smallName
  1086. row.smallId = e.smallNumber
  1087. row.specsName = e.goodsMaterialSpecsName
  1088. row.goodsMaterialName = e.goodsName
  1089. row.goodsMaterialId = e.goodsMaterialId
  1090. row.material = null
  1091. row.materialName = ''
  1092. row.stockQty = ''
  1093. row.uniqueCode = ''
  1094. row.materialList = await this.getMaterialList(row.specsName,row.goodsMaterialItemType)
  1095. row.orderDetailId = e.orderDetailId
  1096. },
  1097. async changeMaterial(e,row){
  1098. if(!row.specs){
  1099. return this.$message.warning('请先选择规格型号!');
  1100. }
  1101. row.material = null
  1102. row.materialName = ''
  1103. row.stockQty = ''
  1104. row.uniqueCode = ''
  1105. row.materialList = await this.getMaterialList(row.specsName,row.goodsMaterialItemType)
  1106. },
  1107. //发货新增条码
  1108. addCode(){
  1109. this.$refs.formData2.validate((valid) => {
  1110. if (valid) {
  1111. this.isEdit2 = 0
  1112. this.formData2.list.unshift({
  1113. brandId: '',
  1114. brandName: '',
  1115. mainId: '',
  1116. mainName: '',
  1117. stockQty: '',
  1118. smallId: '',
  1119. smallName: '',
  1120. goodsMaterialItemType: '',
  1121. goodsMaterialName: '',
  1122. goodsMaterialId: '',
  1123. materialCode: '',
  1124. uniqueCode: '',
  1125. specs: null,
  1126. specsName: '',
  1127. materialName: '',
  1128. material: null,
  1129. materialList: [],
  1130. orderDetailId: '',
  1131. goodsMaterialItemId: ''
  1132. })
  1133. }
  1134. });
  1135. },
  1136. delCode(orderDetailCodeId,index){
  1137. if(orderDetailCodeId){
  1138. delCode({
  1139. orderDetailCodeId
  1140. }).then(res => {
  1141. if (res.code == 200) {
  1142. this.$message({ type: 'success', message: '删除成功!' })
  1143. this.getOrderDetail()
  1144. this.getCodeDetail()
  1145. } else {
  1146. this.$message.error(res.msg);
  1147. }
  1148. })
  1149. }else{
  1150. this.formData2.list.splice(index,1)
  1151. }
  1152. },
  1153. saveCode(orderDetailCodes){
  1154. const that = this
  1155. let params = [{
  1156. ...orderDetailCodes,
  1157. orderId: this.orderId,
  1158. }]
  1159. delete params[0].material;
  1160. delete params[0].specs;
  1161. this.$refs.formData2.validate((valid, invalidFields, errLabels) => {
  1162. if (valid) {
  1163. saveCode(params).then(res=>{
  1164. if(res.code == 200){
  1165. that.$message.success('保存成功!')
  1166. this.getOrderDetail()
  1167. this.getCodeDetail()
  1168. }
  1169. })
  1170. }
  1171. })
  1172. },
  1173. deliverSelectionChange(val) {
  1174. this.deliverSelection = val;
  1175. },
  1176. deliverGoods(){
  1177. this.$refs.orderForm.validate((valid) => {
  1178. if (valid) {
  1179. if(this.deliverSelection.length < 1) return this.$errorMsg('请选择一个发货信息');
  1180. for (let i = 0; i < this.deliverSelection.length; i++) {
  1181. const item = this.deliverSelection[i];
  1182. if(!item.num || item.num == 0) return this.$errorMsg('请填写发货数量-订单数量');
  1183. }
  1184. orderDeliver({
  1185. orderId: this.orderId,
  1186. logisticsNo: this.orderForm.pickType == 'NO' ? this.orderForm.logisticsNo : '',
  1187. storageId: this.orderForm.storageId,
  1188. companyCode: this.orderForm.pickType == 'NO' ? this.orderForm.companyCode : '',
  1189. workOrder: this.orderForm.workOrder,
  1190. pickName: this.orderForm.pickType == 'YES' ? this.orderForm.pickName : '',
  1191. pickPhone: this.orderForm.pickType == 'YES' ? this.orderForm.pickPhone : '',
  1192. pickType: this.orderForm.pickType,
  1193. orderDeliveryDetailList: this.deliverSelection.map(item => {
  1194. return {
  1195. orderDetailId: item.orderDetailId,
  1196. sendNum: item.num,
  1197. sendInsideCodeQty: item.insideCodeQty,
  1198. sendOutCodeQty: item.outCodeQty,
  1199. sendPartsCodeQty: item.partsCodeQty,
  1200. }
  1201. }),
  1202. }).then(() => {
  1203. this.cancelForm();
  1204. this.getDetail();
  1205. this.getDeliverList();
  1206. this.$successMsg('发货成功');
  1207. })
  1208. }
  1209. })
  1210. },
  1211. importCode(data){
  1212. const loading = this.$loading({
  1213. lock: true,
  1214. text: '正在导入',
  1215. spinner: 'el-icon-loading',
  1216. background: 'rgba(0, 0, 0, 0.7)'
  1217. })
  1218. var formdata = new FormData()
  1219. formdata.append('file', data.file)
  1220. let params = {
  1221. orderDetailId: this.orderDetailId
  1222. }
  1223. if (!!params) {
  1224. for (const key in params) {
  1225. if (Object.hasOwnProperty.call(params, key)) {
  1226. formdata.append(key, params[key])
  1227. }
  1228. }
  1229. }
  1230. listImport({ formdata })
  1231. .then(res => {
  1232. this.getOrderDetail()
  1233. loading.close()
  1234. this.$message({
  1235. type: 'success',
  1236. message: '导入成功!'
  1237. })
  1238. })
  1239. .catch(err => {
  1240. loading.close()
  1241. this.$message({
  1242. type: 'error',
  1243. message: err.message || '导入失败'
  1244. })
  1245. })
  1246. },
  1247. // 下载导入模版
  1248. handleDownload(title) {
  1249. commonTemplateDownload({ name: '导入条码.xlsx' }, title).then(res => {
  1250. this.$message({
  1251. message: '下载成功',
  1252. type: 'success'
  1253. })
  1254. }).catch(err => {
  1255. this.$message.error('下载失败')
  1256. })
  1257. },
  1258. },
  1259. computed: {
  1260. ...mapGetters([
  1261. 'userid',
  1262. 'name'
  1263. ]),
  1264. curOrderStatus() {
  1265. switch (this.orderDetail.orderStatus) {
  1266. case 'NOPAY':
  1267. return 1
  1268. break;
  1269. case 'DFH':
  1270. return 2
  1271. break;
  1272. case 'YFH':
  1273. return 3
  1274. break;
  1275. case 'OVER':
  1276. return 4
  1277. break;
  1278. default:
  1279. return 1
  1280. }
  1281. },
  1282. totalAmountCompute() {
  1283. if (!this.orderDetail.totalAmount) {
  1284. return 0
  1285. }
  1286. const totalAmount = parseFloat(this.orderDetail.totalAmount)
  1287. const freight = parseFloat(this.orderDetail.freight)
  1288. return (totalAmount - freight).toFixed(2)
  1289. },
  1290. }
  1291. }
  1292. </script>
  1293. <style scoped lang="scss">
  1294. .order-main {
  1295. margin-top: 15px;
  1296. border: 1px solid #e5e5e5;
  1297. .order-main-title {
  1298. font-size: 14px;
  1299. }
  1300. .order-main-title span {
  1301. margin-right: 15px;
  1302. }
  1303. .order-main-status {
  1304. padding: 15px 0;
  1305. font-size: 24px;
  1306. color: #409EFF;
  1307. }
  1308. .order-main-opt-btn {
  1309. padding: 15px 0;
  1310. }
  1311. }
  1312. .order-receive-info {
  1313. margin: 15px 0 30px;
  1314. padding: 15px;
  1315. background: #f5f7fa;
  1316. :first-child div span {
  1317. padding-right: 15px;
  1318. }
  1319. }
  1320. .order-detail {
  1321. background: #f5f7fa;
  1322. .order-amount-info {
  1323. padding: 15px 0;
  1324. font-size: 12px;
  1325. font-weight: bold;
  1326. }
  1327. ::v-deep .el-table tr,
  1328. ::v-deep .el-table th {
  1329. background-color: #f5f7fa;
  1330. }
  1331. }
  1332. .main-detail {
  1333. .title {
  1334. font-size: 16px;
  1335. font-weight: 700;
  1336. margin-bottom: 20px;
  1337. }
  1338. .item {
  1339. display: flex;
  1340. font-size: 14px;
  1341. color: #666;
  1342. padding-bottom: 12px;
  1343. .label {
  1344. white-space: nowrap;
  1345. }
  1346. }
  1347. }
  1348. .order-evaluate-info {
  1349. margin: 15px 0;
  1350. padding: 30px 15px;
  1351. background: #f5f7fa;
  1352. .title {
  1353. display: flex;
  1354. justify-content: space-between;
  1355. align-items: center;
  1356. .left {
  1357. font-size: 16px;
  1358. font-weight: 700;
  1359. span {
  1360. font-weight: normal;
  1361. margin-left: 20px;
  1362. font-size: 14px;
  1363. color: #666;
  1364. }
  1365. }
  1366. .right {
  1367. display: flex;
  1368. align-items: center;
  1369. font-size: 14px;
  1370. span {
  1371. margin-right: 10px;
  1372. }
  1373. }
  1374. }
  1375. .main {
  1376. margin-top: 20px;
  1377. display: flex;
  1378. .rate-list {
  1379. font-size: 14px;
  1380. flex-shrink: 0;
  1381. }
  1382. .tag-list {
  1383. margin-left: 30px;
  1384. ::v-deep .el-tag {
  1385. margin-right: 10px;
  1386. margin-bottom: 10px;
  1387. }
  1388. }
  1389. }
  1390. .content {
  1391. width: 400px;
  1392. line-height: 20px;
  1393. font-size: 14px;
  1394. color: #333;
  1395. margin-top: 10px;
  1396. }
  1397. .img-list {
  1398. display: flex;
  1399. flex-wrap: wrap;
  1400. margin-top: 10px;
  1401. width: 400px;
  1402. ::v-deep .el-image {
  1403. width: 100px;
  1404. height: 100px;
  1405. margin-right: 10px;
  1406. margin-bottom: 10px;
  1407. border: 1px solid #eaeaea;
  1408. }
  1409. }
  1410. }
  1411. </style>