index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <template>
  2. <el-card :class="selectStatusDiscount ? 'box-cardTwo' : 'box-card'">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true">
  4. <el-form-item label="事业部" prop="subsidiaryName">
  5. <el-input placeholder="请输入" v-model="queryParams.subsidiaryName" clearable size="small" @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <!-- <el-form-item label="变更状态" prop="types">
  8. <el-select v-model="queryParams.types" placeholder="请选择" style="width: 100%" @change="handleQuery">
  9. <el-option v-for="item in situation" :key="item.id" :label="item.dictValue" :value="item.dictKey"> </el-option>
  10. </el-select>
  11. </el-form-item> -->
  12. <el-form-item label="订单号" prop="contractCode">
  13. <el-input placeholder="请输入" v-model="queryParams.contractCode" clearable size="small" @keyup.enter.native="handleQuery" />
  14. </el-form-item>
  15. <el-form-item label="万里牛单号" prop="tradeNo">
  16. <el-input placeholder="请输入" v-model="queryParams.tradeNo" clearable size="small" @keyup.enter.native="handleQuery" />
  17. </el-form-item>
  18. <el-form-item label="订单状态" prop="status" v-if="!selectStatus">
  19. <el-select v-model="queryParams.status" placeholder="请选择" style="width: 100%" @change="handleQuery">
  20. <el-option v-for="item in orderStatus" :key="item.id" :label="item.dictValue" :value="item.dictKey"> </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="结算状态" prop="settlementStatus" v-if="!selectStatus">
  24. <el-select v-model="queryParams.settlementStatus" placeholder="请选择" style="width: 100%" @change="handleQuery">
  25. <el-option v-for="item in settlementStatus" :key="item.id" :label="item.dictValue" :value="item.dictKey"> </el-option>
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="下单时间">
  29. <el-form-item>
  30. <el-button size="mini" :class="selectBtn === 1 ? 'select' : ''" @click="handleNearTime(1)">近7天</el-button>
  31. <el-button size="mini" :class="selectBtn === 2 ? 'select' : ''" @click="handleNearTime(2)">近30天</el-button>
  32. </el-form-item>
  33. <el-form-item label="">
  34. <el-col :span="11">
  35. <el-date-picker
  36. type="datetime"
  37. placeholder="开始日期"
  38. v-model="queryParams.beginTime"
  39. value-format="yyyy-MM-dd HH:mm:ss"
  40. size="small"
  41. style="width: 100%"
  42. ></el-date-picker>
  43. </el-col>
  44. <el-col :span="2" style="text-align: center">-</el-col>
  45. <el-col :span="11">
  46. <el-date-picker
  47. type="datetime"
  48. placeholder="结束日期"
  49. v-model="queryParams.endTime"
  50. value-format="yyyy-MM-dd HH:mm:ss"
  51. size="small"
  52. style="width: 100%"
  53. ></el-date-picker>
  54. </el-col>
  55. </el-form-item>
  56. </el-form-item>
  57. <el-form-item>
  58. <el-button size="mini" @click="handleQuery" class="searchBtn">搜索</el-button>
  59. <el-button size="mini" @click="resetQuery">重置</el-button>
  60. </el-form-item>
  61. </el-form>
  62. <div style="width: 100%; position: relative">
  63. <!-- <div style="position: absolute; right: 0; top: -34px; width: 120px; text-align: center">
  64. <el-button type="primary" size="mini" @click="openOperationLog = true" v-db-click>操作日志</el-button>
  65. </div> -->
  66. <el-table
  67. :data="tableList"
  68. :cell-style="{ padding: '0' }"
  69. :row-style="{ height: '35px' }"
  70. header-row-class-name="tableHeader"
  71. v-loading="loading"
  72. element-loading-background="rgba(0, 0, 0, 0.3)"
  73. >
  74. <el-table-column label="事业部" prop="subsidiaryName" width="140" />
  75. <el-table-column label="订单号" prop="contractCode" width="180">
  76. <template slot-scope="scope">
  77. <div>
  78. <span style="cursor: pointer; color: #409eff" @click="clickCode(scope.row)"> {{ scope.row.contractCode }}</span>
  79. <span class="aaa" v-if="scope.row.aftermarketId" @click="clickAftermarketDetails(scope.row.aftermarketId)" v-db-click>
  80. <span style="display: block; color: #ffffff; height: 20px; line-height: 20px; text-align: center">售后</span>
  81. </span>
  82. </div>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="万里牛订单号" prop="tradeNo" width="140" />
  86. <el-table-column label="快递单号" prop="waybillNo" width="140" />
  87. <el-table-column label="订单状态" prop="status" width="100">
  88. <template slot-scope="scope">
  89. <span> {{ showStatus(scope.row.status) }}</span>
  90. </template>
  91. </el-table-column>
  92. <el-table-column label="结算状态" prop="settlementStatus" width="100">
  93. <template slot-scope="scope">
  94. <span> {{ showSettleStatus(scope.row.settlementStatus) }}</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="税率" align="center" width="120">
  98. <template slot-scope="scope">
  99. <span v-if="scope.row.taxRate">{{ Number(scope.row.taxRate) }}%</span>
  100. <span v-else>0%</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="订单总金额 ¥" align="right" width="120">
  104. <template slot-scope="scope">
  105. <span style="color: #409eff">{{ moneyFormat(scope.row.contractAmount, 2) }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="产品总金额 ¥" align="right" width="120">
  109. <template slot-scope="scope">
  110. <span>{{ moneyFormat(scope.row.productPriceAmount, 2) }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column label="定制加工费 ¥" align="right" width="120">
  114. <template slot-scope="scope">
  115. <span>{{ moneyFormat(scope.row.processPrice, 2) }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column label="代发费 ¥" align="right" width="120">
  119. <template slot-scope="scope">
  120. <span>{{ moneyFormat(scope.row.deliverGoodsPriceAmount, 2) }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="快递包材费 ¥" align="right" width="120">
  124. <template slot-scope="scope">
  125. <span>{{ moneyFormat(scope.row.expressPriceAmount, 2) }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column label="包装人工费 ¥" align="right" width="120">
  129. <template slot-scope="scope">
  130. <span>{{ moneyFormat(scope.row.expensePriceAmount, 2) }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="包材费 ¥" align="right" width="120">
  134. <template slot-scope="scope">
  135. <span>{{ moneyFormat(scope.row.packingMaterialAmount, 2) }}</span>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="交期" prop="deliveryTime" align="center" width="140" />
  139. <el-table-column label="下单时间" prop="createTime" align="center" width="140" />
  140. <el-table-column label="发货时间" prop="shipmentTime" align="center" width="140" />
  141. <el-table-column label="收货人" prop="harvester" width="100" />
  142. <el-table-column label="收货人电话" prop="harvesterPhone" width="140" />
  143. <el-table-column label="收货人地址" prop="harvestAddress" min-width="240">
  144. <template slot-scope="scope">
  145. <div>
  146. {{ scope.row.harvesterCountryName }}, {{ scope.row.harvesterCityName }}, {{ scope.row.harvesterArea }},
  147. {{ scope.row.harvestAddress }}
  148. </div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="操作" align="center" width="120" fixed="right">
  152. <template slot-scope="scope">
  153. <el-button type="text" v-if="!(selectStatus || selectStatusDiscount)" @click="clickTaxRate(scope.row)" v-db-click>税率</el-button>
  154. <el-button type="text" v-if="selectStatus || selectStatusDiscount" @click="clickSelect(scope.row)" v-db-click>选择</el-button>
  155. <el-button
  156. type="text"
  157. v-if="(scope.row.status == '0' || scope.row.status == '10' || scope.row.status == '20') && !(selectStatus || selectStatusDiscount)"
  158. @click="clickDelete(scope.row)"
  159. v-db-click
  160. >删除</el-button
  161. >
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <!-- 分页器 -->
  166. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  167. </div>
  168. <el-dialog title="修改税率" v-if="open" :visible.sync="open" width="40%" append-to-body>
  169. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  170. <el-form-item label="税率 (%):" prop="taxRate">
  171. <el-input-number
  172. size="small"
  173. style="width: 100%"
  174. v-model="form.taxRate"
  175. placeholder="请输入税率"
  176. :controls="false"
  177. :min="0"
  178. :max="100"
  179. :precision="2"
  180. />
  181. </el-form-item>
  182. <div style="text-align: center">
  183. <el-button type="primary" @click="submitForm" v-db-click>确 定</el-button>
  184. <el-button @click="open = false" v-db-click>取 消</el-button>
  185. </div>
  186. </el-form>
  187. </el-dialog>
  188. <el-dialog title="操作日志" v-if="openOperationLog" :visible.sync="openOperationLog" width="50%" append-to-body>
  189. <OperationLog :operationLogKey="operationLogKey"></OperationLog>
  190. <div style="text-align: center; margin-top: 20px">
  191. <el-button @click="openOperationLog = false" v-db-click>关 闭</el-button>
  192. </div>
  193. </el-dialog>
  194. </el-card>
  195. </template>
  196. <script>
  197. import * as API from '@/api/shengde/group/order/orderManagement.js'
  198. import { mapGetters } from 'vuex'
  199. import OperationLog from '@/components/shengde/operationLog/index'
  200. export default {
  201. props: {
  202. selectStatus: Boolean,
  203. selectStatusDiscount: Boolean,
  204. },
  205. components: { OperationLog },
  206. data() {
  207. return {
  208. loading: false,
  209. selectBtn: null,
  210. settlementStatus: [
  211. {
  212. id: '0',
  213. dictValue: '未结算',
  214. dictKey: '0',
  215. },
  216. {
  217. id: '2',
  218. dictValue: '已对账',
  219. dictKey: '2',
  220. },
  221. {
  222. id: '1',
  223. dictValue: '已结算',
  224. dictKey: '1',
  225. },
  226. ],
  227. orderStatus: [],
  228. queryParams: {
  229. pageNum: 1,
  230. pageSize: 10,
  231. subsidiaryName: '',
  232. contractCode: '',
  233. tradeNo: '',
  234. status: '',
  235. beginTime: '',
  236. endTime: '',
  237. queryType: '0',
  238. },
  239. tableList: [],
  240. total: null,
  241. open: false,
  242. form: {
  243. contractIds: '',
  244. taxRate: '',
  245. },
  246. rules: {
  247. taxRate: [{ required: true, message: '请输入税率', trigger: 'blur' }],
  248. },
  249. openOperationLog: false,
  250. operationLogKey: 10,
  251. }
  252. },
  253. created() {
  254. if (this.selectStatus) {
  255. this.queryParams.queryType = '1'
  256. }
  257. this.orderStatus = this.dictData.filter((item) => item.code === 'order_status')[0].children
  258. },
  259. mounted() {
  260. this.handleNearTime(2)
  261. },
  262. computed: mapGetters(['dictData']),
  263. methods: {
  264. getList() {
  265. this.loading = true
  266. API.getList(this.queryParams).then(
  267. (res) => {
  268. this.tableList = res.data.data.records
  269. this.total = res.data.data.total
  270. this.loading = false
  271. },
  272. (err) => {
  273. console.log('getList:' + err)
  274. this.loading = false
  275. }
  276. )
  277. },
  278. handleQuery() {
  279. this.queryParams.pageNum = 1
  280. this.getList()
  281. },
  282. resetQuery() {
  283. this.resetForm('queryForm')
  284. this.handleNearTime(2)
  285. },
  286. showStatus(type) {
  287. if (type !== '') return this.feedbackLabel(this.orderStatus, type.toString())
  288. },
  289. showSettleStatus(type) {
  290. if (type !== '') return this.feedbackLabel(this.settlementStatus, type.toString())
  291. },
  292. handleNearTime(status) {
  293. this.selectBtn = status
  294. if (status === 1) {
  295. //近7天
  296. let obj = this.getDays(6)
  297. this.queryParams.beginTime = obj.startTime
  298. this.queryParams.endTime = obj.endTime
  299. } else if (status === 2) {
  300. //近30天
  301. let obj = this.getDays(29)
  302. this.queryParams.beginTime = obj.startTime
  303. this.queryParams.endTime = obj.endTime
  304. }
  305. this.handleQuery()
  306. },
  307. clickCode(row) {
  308. if (row.dataResource === 0) {
  309. this.$router.push({
  310. path: '/shengde/subsidiary/order/management/OrderDetail',
  311. query: {
  312. id: row.id,
  313. },
  314. })
  315. } else if (row.dataResource === 1) {
  316. this.$router.push({
  317. path: '/shengde/subsidiary/order/management/OrderDetail1',
  318. query: {
  319. id: row.id,
  320. },
  321. })
  322. }
  323. },
  324. clickSelect(row) {
  325. this.$emit('clickSelect', row)
  326. },
  327. clickDelete(row) {
  328. this.$confirm('是否确认删除数据?', '警告', {
  329. confirmButtonText: '确定',
  330. cancelButtonText: '取消',
  331. type: 'warning',
  332. })
  333. .then(() => {
  334. API.deleteContract({ id: row.id }).then(() => {
  335. this.msgSuccess('删除成功!')
  336. this.getList()
  337. })
  338. })
  339. .catch(() => {})
  340. },
  341. clickAftermarketDetails(id) {
  342. this.$router.push({
  343. path: '/afterSales/transactionDetails',
  344. query: {
  345. afterSalesId: id,
  346. },
  347. })
  348. },
  349. clickTaxRate(item) {
  350. this.form = {
  351. contractIds: item.id,
  352. taxRate: item.taxRate,
  353. }
  354. this.open = true
  355. },
  356. submitForm() {
  357. this.$refs.form.validate((valid) => {
  358. if (valid) {
  359. API.batchEditTaxRate(this.form).then(() => {
  360. this.msgSuccess('修改完成')
  361. this.open = false
  362. this.getList()
  363. })
  364. }
  365. })
  366. },
  367. },
  368. }
  369. </script>
  370. <style lang="scss" scoped>
  371. .box-card {
  372. height: calc(100vh - 110px);
  373. overflow-y: auto;
  374. }
  375. .box-cardTwo {
  376. height: calc(100vh - 110px - 10px);
  377. overflow-y: auto;
  378. }
  379. ::v-deep {
  380. .el-input__inner {
  381. height: 28px;
  382. line-height: 28px;
  383. }
  384. .el-button {
  385. border-radius: 0;
  386. }
  387. .miniBtn .el-button {
  388. padding: 0px !important;
  389. }
  390. .tableHeader th {
  391. background-color: #edf0f5;
  392. height: 35px;
  393. padding: 0;
  394. }
  395. .head .el-form-item__label {
  396. padding: 0;
  397. color: #940819;
  398. }
  399. .head .el-form-item__content {
  400. min-width: 0;
  401. }
  402. .el-input-number {
  403. .el-input__inner {
  404. text-align: left !important;
  405. }
  406. }
  407. }
  408. .searchBtn {
  409. background: #20b2aa;
  410. color: #fff;
  411. border: 1px solid #20b2aa;
  412. }
  413. .select {
  414. background: #02a7f0;
  415. color: #fff;
  416. border: 1px solid #02a7f0;
  417. }
  418. .aaa {
  419. border-radius: 10px;
  420. height: 20px;
  421. width: 40px;
  422. display: inline-block;
  423. background: #f30303;
  424. vertical-align: top;
  425. cursor: pointer;
  426. margin-left: 16px;
  427. }
  428. </style>