lifeServicesOrder.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" @submit.native.prevent :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="订单编号" prop="orderNo">
  5. <el-input v-model="queryParams.orderNo" placeholder="请输入订单编号" clearable @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="订单状态" prop="orderStatus">
  8. <el-select v-model="queryParams.orderStatus" placeholder="请选择支付状态" clearable>
  9. <el-option v-for="dict in dict.type.order_goods_status" :key="dict.value" :label="dict.label" :value="dict.value" />
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="客户姓名" prop="realName">
  13. <el-input v-model="queryParams.realName" placeholder="请输入客户姓名" clearable @keyup.enter.native="handleQuery" />
  14. </el-form-item>
  15. <el-form-item label="手机号" prop="phoneNumber">
  16. <el-input v-model="queryParams.phoneNumber" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" />
  17. </el-form-item>
  18. <el-form-item label="支付时间">
  19. <el-date-picker clearable v-model="queryPayTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="getPayTime"> </el-date-picker>
  20. </el-form-item>
  21. <el-form-item label="下单时间">
  22. <el-date-picker clearable v-model="queryCreateTime" type="daterange" value-format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="getCreateTime"> </el-date-picker>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  26. <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  27. </el-form-item>
  28. </el-form>
  29. <el-row :gutter="10" class="mb8">
  30. <!-- <el-col :span="1.5">-->
  31. <!-- <el-button type="warning" plain icon="el-icon-download" @click="handleExport" v-hasPermi="['order:goods:export']" v-if="userInfoVO.userType == '00'">导出</el-button>-->
  32. <!-- </el-col>-->
  33. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  34. </el-row>
  35. <Page uri="/mapi/order/goods/list" :request-params="queryParams" ref="pagination">
  36. <el-table-column label="订单编号" align="center" prop="orderNo" width="150px" />
  37. <el-table-column label="客户信息" align="center" width="150">
  38. <template slot-scope="scope">
  39. <span>{{ scope.row.realName ? scope.row.realName : '--' }}</span>
  40. <br />
  41. <span>{{ scope.row.phoneNumber ? scope.row.phoneNumber : '' }}</span>
  42. </template>
  43. </el-table-column>
  44. <el-table-column label="预约时间" align="center" prop="appointmentTime" width="150px">
  45. <template slot-scope="scope">
  46. {{ scope.row.appointmentTime ? scope.row.appointmentTime : '--' }}
  47. </template>
  48. </el-table-column>
  49. <el-table-column label="订单总价" align="center" prop="totalPrice" width="100px" />
  50. <el-table-column label="抵扣金额" align="center" prop="deductAmount" width="100px">
  51. <template slot-scope="scope">
  52. {{ scope.row.deductAmount ? scope.row.deductAmount : '--' }}
  53. </template>
  54. </el-table-column>
  55. <el-table-column label="支付金额" align="center" prop="payAmount" width="100px" />
  56. <el-table-column label="支付方式" align="center" prop="payType" width="100px">
  57. <template slot-scope="scope">
  58. <dict-tag :options="dict.type.recharge_pay_type" :value="scope.row.payType" />
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="订单状态" align="center" prop="orderStatus">
  62. <template slot-scope="scope">
  63. <dict-tag :options="dict.type.order_goods_status" :value="scope.row.orderStatus" />
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="下单时间" align="center" prop="createTime" width="150px" />
  67. <el-table-column label="支付时间" align="center" prop="payTime" width="150px">
  68. <template slot-scope="scope">
  69. {{ scope.row.payTime ? scope.row.payTime : '--' }}
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200">
  73. <template slot-scope="scope">
  74. <el-button type="text" icon="el-icon-chat-dot-square" @click="orderDetail(scope.row)">订单详情</el-button>
  75. <el-button type="text" icon="el-icon-check" @click="btn_receiving(scope.row)" v-if="scope.row.orderStatus == '1'">接单</el-button>
  76. <el-button type="text" icon="el-icon-check" @click="btn_confirm(scope.row)" v-if="scope.row.orderStatus == '2'">确认</el-button>
  77. </template>
  78. </el-table-column>
  79. </Page>
  80. <!-- 详情-->
  81. <el-dialog :title="detailTitle" :visible.sync="openDetail" width="80%" append-to-body>
  82. <el-card>
  83. <el-descriptions title="客户信息" v-show="detailView" :column="3" border :label-style="{ 'text-align': 'center' }" :contentStyle="{ 'text-align': 'center' }">
  84. <el-descriptions-item label="客户姓名">{{ detailView.realName }}</el-descriptions-item>
  85. <el-descriptions-item label="客户手机号">{{ detailView.phoneNumber }}</el-descriptions-item>
  86. <el-descriptions-item label="订单状态">
  87. <dict-tag :options="dict.type.order_goods_status" :value="detailView.orderStatus" />
  88. </el-descriptions-item>
  89. <el-descriptions-item label="收货联系人">{{ detailView.contactName ? detailView.contactName : '暂无信息' }}</el-descriptions-item>
  90. <el-descriptions-item label="收货人手机号">{{ detailView.contactPhone ? detailView.contactPhone : '暂无信息' }}</el-descriptions-item>
  91. <el-descriptions-item label="下单时间">{{ detailView.createTime ? detailView.createTime : '暂无信息' }}</el-descriptions-item>
  92. <el-descriptions-item label="支付时间">{{ detailView.payTime ? detailView.payTime : '暂无信息' }}</el-descriptions-item>
  93. <!-- <el-descriptions-item label="发货时间">{{detailView.sendTime?detailView.sendTime:'暂无信息'}}</el-descriptions-item>-->
  94. <el-descriptions-item label="预约时间">{{ detailView.appointmentTime ? detailView.appointmentTime : '暂无信息' }}</el-descriptions-item>
  95. <el-descriptions-item label="确认收货时间">{{ detailView.finishTime ? detailView.finishTime : '暂无信息' }}</el-descriptions-item>
  96. <el-descriptions-item label="订单总价">{{ detailView.totalPrice ? detailView.totalPrice : '暂无信息' }}</el-descriptions-item>
  97. <!-- <el-descriptions-item label="物流公司">{{detailView.deliveryCompany?detailView.deliveryCompany:'暂无信息'}}</el-descriptions-item>-->
  98. <!-- <el-descriptions-item label="物流单号">{{detailView.totalPrice?detailView.totalPrice:'暂无信息'}}</el-descriptions-item>-->
  99. <el-descriptions-item label="收货地址" span="3">{{ detailView.province }}{{ detailView.city }}{{ detailView.area }}{{ detailView.address }}{{ detailView.addressDetail }}</el-descriptions-item>
  100. <el-descriptions-item label="备注信息" span="3">{{ detailView.deliveryNo ? detailView.deliveryNo : '暂无信息' }}</el-descriptions-item>
  101. </el-descriptions>
  102. </el-card>
  103. <div class="head-column2">
  104. <el-table v-loading="detailLoading" :data="detailView.orderGoodsSkuList">
  105. <el-table-column label="分类" align="center" prop="goodsCategoryName" />
  106. <el-table-column :label="goodsType == 0 ? '商品名称' : '材料名称'" align="center" prop="goodsName" width="250px" />
  107. <el-table-column :label="goodsType == 0 ? '商品规格' : '材料规格'" align="center" width="250px">
  108. <template slot-scope="scope">
  109. <div style="text-align: center">{{ scope.row.skuName.replace(' ', '/') }}</div>
  110. </template>
  111. </el-table-column>
  112. <el-table-column label="数量" align="center" prop="buyNum" />
  113. <el-table-column label="价格(元)" align="center" prop="salePrice" />
  114. <el-table-column label="总和(元)" align="center">
  115. <template slot-scope="scope">
  116. <span>{{ scope.row.buyNum * scope.row.salePrice }}</span>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </div>
  121. <el-row :gutter="10" class="box-shadow" style="margin-top: 10px">
  122. <el-col :span="21">
  123. <el-form label-width="130px" style="height: 80px; padding-top: 20px; text-align: right" :inline="true" size="small">
  124. <el-form-item label="总金额(元):">
  125. {{ costTotalPrice }}
  126. </el-form-item>
  127. </el-form>
  128. </el-col>
  129. </el-row>
  130. </el-dialog>
  131. </div>
  132. </template>
  133. <script>
  134. import { getGoods, listGoods, receiveOrder, confirmFinish } from '@/api/order/goods'
  135. import { findUserByPhoneNumber, getUser } from '@/api/app/user'
  136. export default {
  137. name: 'lifeServicesOrder',
  138. dicts: ['order_goods_status', 'delivery_company', 'recharge_pay_type'],
  139. data() {
  140. return {
  141. userInfoVO: null,
  142. //
  143. orderLoading: true,
  144. // 遮罩层
  145. loading: false,
  146. detailLoading: true,
  147. // 选中数组
  148. ids: [],
  149. // 非单个禁用
  150. single: true,
  151. // 非多个禁用
  152. multiple: true,
  153. // 显示搜索条件
  154. showSearch: true,
  155. // 总条数
  156. total: 0,
  157. // 弹出层标题
  158. title: '',
  159. detailTitle: '',
  160. // 是否显示弹出层
  161. open: false,
  162. openDetail: false,
  163. openRePayPage: false,
  164. openDeliveryPage: false,
  165. // 查询参数
  166. queryParams: {
  167. realName: null,
  168. phoneNumber: null,
  169. orderNo: null,
  170. orderStatus: null
  171. },
  172. // 表单参数
  173. payFrom: {},
  174. // 表单校验
  175. rules: {},
  176. goodsType: null,
  177. // 商品订单表格数据
  178. GoodsList: [],
  179. // 可选商品集合
  180. goodsList: null,
  181. // 已选商品集合
  182. addGoodsList: [],
  183. // 自定义一个计算数量的临时对象集合
  184. purchaseCountVOList: [],
  185. // 总金额
  186. totalPrice: 0,
  187. // 总件数
  188. totalCount: 0,
  189. // 详情数据
  190. detailView: {},
  191. // 详情总金额
  192. costTotalPrice: null,
  193. appUserInfo: null,
  194. goodsOrderInfo: null,
  195. payMoney: null,
  196. deliveryVo: {
  197. orderId: null,
  198. deliveryCompany: null,
  199. deliveryNo: null
  200. },
  201. queryCreateTime: null,
  202. queryPayTime: null
  203. }
  204. },
  205. created() {
  206. this.handleUser()
  207. // this.goodsType = this.getUrlParam('goodsType')
  208. this.goodsType = '2'
  209. this.getList()
  210. },
  211. computed: {
  212. calculateTotalCount() {
  213. this.totalCount = 0
  214. this.detailView.orderGoodsSkuList.forEach((vo) => {
  215. this.totalCount = this.totalCount + vo.buyNum
  216. })
  217. return this.totalCount
  218. },
  219. calculatePayMoney() {
  220. this.payMoney = this.payFrom.deductAmount ? this.costTotalPrice - this.payFrom.deductAmount : this.costTotalPrice
  221. return this.payMoney
  222. }
  223. },
  224. methods: {
  225. handleUser() {
  226. this.userInfoVO = this.getUserInfo()
  227. },
  228. getCreateTime() {
  229. if (this.queryCreateTime != null) {
  230. this.queryParams.createTimeFrom = this.queryCreateTime[0]
  231. this.queryParams.createTimeTo = this.queryCreateTime[1]
  232. }
  233. },
  234. getPayTime() {
  235. if (this.queryPayTime != null) {
  236. this.queryParams.beginPayTime = this.queryPayTime[0]
  237. this.queryParams.endPayTime = this.queryPayTime[1]
  238. }
  239. },
  240. getList() {
  241. this.queryParams.goodsType = this.goodsType
  242. this.$nextTick(() => {
  243. this.$refs.pagination.handleSearch(true)
  244. })
  245. },
  246. /** 搜索按钮操作 */
  247. handleQuery() {
  248. this.queryParams.pageNum = 1
  249. this.getList()
  250. },
  251. /** 重置按钮操作 */
  252. resetQuery() {
  253. this.queryCreateTime = null
  254. this.queryParams.createTimeFrom = null
  255. this.queryParams.createTimeTo = null
  256. this.queryPayTime = null
  257. this.queryParams.beginPayTime = null
  258. this.queryParams.endPayTime = null
  259. this.resetForm('queryForm')
  260. this.handleQuery()
  261. },
  262. // 订单详情
  263. orderDetail(row) {
  264. this.openDetail = true
  265. this.detailTitle = '订单商品详情'
  266. this.detailLoading = true
  267. this.detailView = {}
  268. const id = row.id
  269. getGoods(id).then((response) => {
  270. this.detailView = response.data
  271. this.costTotalPrice = this.detailView.totalPrice
  272. this.detailLoading = false
  273. })
  274. },
  275. //接单
  276. btn_receiving(row) {
  277. this.$confirm('是否确认接单?')
  278. .then(() => {
  279. const vo = {
  280. orderId: row.id
  281. }
  282. receiveOrder(vo).then((response2) => {
  283. this.$modal.msgSuccess('接单成功')
  284. this.getList()
  285. })
  286. })
  287. .catch(() => {})
  288. },
  289. //确认订单
  290. btn_confirm(row) {
  291. this.$confirm('是否确认完成该订单?')
  292. .then(() => {
  293. const vo = {
  294. orderId: row.id
  295. }
  296. confirmFinish(vo).then((response2) => {
  297. this.$modal.msgSuccess('确认完成成功')
  298. this.getList()
  299. })
  300. })
  301. .catch(() => {})
  302. },
  303. /** 导出按钮操作 */
  304. handleExport() {
  305. this.download(
  306. 'mapi/order/goods/export',
  307. {
  308. ...this.queryParams,
  309. ...{ goodsType: this.goodsType }
  310. },
  311. `goods_order_${new Date().getTime()}.xlsx`
  312. )
  313. }
  314. }
  315. }
  316. </script>
  317. <style>
  318. .list_title {
  319. text-align: center;
  320. line-height: 40px;
  321. }
  322. .head-container-two {
  323. height: 500px;
  324. display: block;
  325. overflow-y: scroll;
  326. }
  327. .head-column1 {
  328. height: 300px;
  329. display: block;
  330. overflow-y: scroll;
  331. }
  332. .head-column2 {
  333. height: 600px;
  334. display: block;
  335. overflow-y: scroll;
  336. }
  337. .box-shadow .el-button--medium {
  338. font-size: 18px;
  339. }
  340. </style>