|
|
@@ -25,7 +25,7 @@
|
|
|
Action<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item command="edit" @click.native="handleDel(scope.row)" v-if="permission.hasPermission(`shop/edit`)">删除订单</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="edit" @click.native="handleDel(scope.row)" v-if="permission.hasPermission(`shop/edit`)">Delete order</el-dropdown-item>
|
|
|
<!-- <el-dropdown-item command="edit" @click.native="handleEdit(scope.row)" v-if="permission.hasPermission(`shop/edit`)">Edit order<!– 编辑订单 –></el-dropdown-item>
|
|
|
<el-dropdown-item command="delivery" @click.native="handleShowDeliveryDialog(scope.row)" v-if="permission.hasPermission(`shop/order-delivery`) && scope.row['STATUS'] === '1' && scope.row['DELIVERY_STATUS'] === '0' ">deliver goods<!– 发货 –></el-dropdown-item>
|
|
|
<el-dropdown-item command="refund" @click.native="handleRefund(scope.row.SN)" v-if="permission.hasPermission(`shop/order-delivery`) && scope.row['PAY_TYPE'] === 'pay_stack' && scope.row['STATUS'] === '1' && scope.row['DELIVERY_STATUS'] === '0' ">Refund<!– 退款 –></el-dropdown-item> -->
|
|
|
@@ -60,193 +60,193 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import network from '@/utils/network'
|
|
|
- import tool from '@/utils/tool'
|
|
|
- import baseInfo from '@/utils/baseInfo'
|
|
|
- import FilterUser from '@/components/FilterUser'
|
|
|
- import permission from '@/utils/permission'
|
|
|
- import Pagination from '@/components/Pagination'
|
|
|
- import filterHelper from '@/utils/filterHelper'
|
|
|
+import network from '@/utils/network'
|
|
|
+import tool from '@/utils/tool'
|
|
|
+import baseInfo from '@/utils/baseInfo'
|
|
|
+import FilterUser from '@/components/FilterUser'
|
|
|
+import permission from '@/utils/permission'
|
|
|
+import Pagination from '@/components/Pagination'
|
|
|
+import filterHelper from '@/utils/filterHelper'
|
|
|
|
|
|
- export default {
|
|
|
- name: 'shop_order-list',
|
|
|
- components: {FilterUser, Pagination},
|
|
|
- mounted() {
|
|
|
- this.getData()
|
|
|
+export default {
|
|
|
+ name: 'shop_order-list',
|
|
|
+ components: {FilterUser, Pagination},
|
|
|
+ mounted () {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ tableHeaders: null,
|
|
|
+ tableData: null,
|
|
|
+ tableHeight: window.innerHeight - 310,
|
|
|
+ loading: true,
|
|
|
+ multipleSelection: [],
|
|
|
+ currentPage: 1,
|
|
|
+ totalPages: 1,
|
|
|
+ totalCount: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ tool: tool,
|
|
|
+ permission: permission,
|
|
|
+ filterTypes: null,
|
|
|
+ filterModel: {},
|
|
|
+ dialogDeliveryVisible: false,
|
|
|
+ deliveryForm: {
|
|
|
+ sn: '',
|
|
|
+ expressCompany: '',
|
|
|
+ orderTrackNo: '',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ handleSelectionChange (val) {
|
|
|
+ this.multipleSelection = val
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- tableHeaders: null,
|
|
|
- tableData: null,
|
|
|
- tableHeight: window.innerHeight - 310,
|
|
|
- loading: true,
|
|
|
- multipleSelection: [],
|
|
|
- currentPage: 1,
|
|
|
- totalPages: 1,
|
|
|
- totalCount: 1,
|
|
|
- pageSize: 20,
|
|
|
- tool: tool,
|
|
|
- permission: permission,
|
|
|
- filterTypes: null,
|
|
|
- filterModel: {},
|
|
|
- dialogDeliveryVisible: false,
|
|
|
- deliveryForm: {
|
|
|
- sn: '',
|
|
|
- expressCompany: '',
|
|
|
- orderTrackNo: '',
|
|
|
- },
|
|
|
- }
|
|
|
+ handleCurrentChange (page) {
|
|
|
+ this.getData(page, this.pageSize)
|
|
|
},
|
|
|
- methods: {
|
|
|
- handleSelectionChange(val) {
|
|
|
- this.multipleSelection = val
|
|
|
- },
|
|
|
- handleCurrentChange(page) {
|
|
|
- this.getData(page, this.pageSize)
|
|
|
- },
|
|
|
- handleSizeChange(pageSize) {
|
|
|
- this.getData(this.currentPage, pageSize)
|
|
|
- },
|
|
|
- handleFilterUser(filterData) {
|
|
|
- filterHelper.handleFilterUser(this, filterData)
|
|
|
- },
|
|
|
- getData(page, pageSize) {
|
|
|
- let filterData = this.filterModel
|
|
|
- network.getPageData(this, 'shop/order-list', page, pageSize, filterData, response => {
|
|
|
- this.filterTypes = response.filterTypes
|
|
|
- this.allData = response
|
|
|
+ handleSizeChange (pageSize) {
|
|
|
+ this.getData(this.currentPage, pageSize)
|
|
|
+ },
|
|
|
+ handleFilterUser (filterData) {
|
|
|
+ filterHelper.handleFilterUser(this, filterData)
|
|
|
+ },
|
|
|
+ getData (page, pageSize) {
|
|
|
+ let filterData = this.filterModel
|
|
|
+ network.getPageData(this, 'shop/order-list', page, pageSize, filterData, response => {
|
|
|
+ this.filterTypes = response.filterTypes
|
|
|
+ this.allData = response
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleExport (){
|
|
|
+ this.$confirm(`Are you sure you want to export the current data?`, 'Hint', {//`确定要导出当前数据吗?`, '提示'
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ return network.getData(`shop/order-list-export`, this.filterModel)
|
|
|
+ }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
})
|
|
|
- },
|
|
|
- handleExport(){
|
|
|
- this.$confirm(`Are you sure you want to export the current data?`, 'Hint', {//`确定要导出当前数据吗?`, '提示'
|
|
|
- confirmButtonText: 'confirm',//确定
|
|
|
- cancelButtonText: 'cancel',//取消
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- return network.getData(`shop/order-list-export`, this.filterModel)
|
|
|
- }).then(response => {
|
|
|
- this.$message({
|
|
|
- message: response,
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- }).catch(response => {
|
|
|
+ }).catch(response => {
|
|
|
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleExportPDF () {
|
|
|
+ if (this.multipleSelection.length === 0) {
|
|
|
+ this.$message({
|
|
|
+ message: 'Please select an order to export', // 请选择一条订单导出
|
|
|
+ type: 'error'
|
|
|
})
|
|
|
- },
|
|
|
- handleExportPDF() {
|
|
|
- if (this.multipleSelection.length === 0) {
|
|
|
- this.$message({
|
|
|
- message: 'Please select an order to export',//请选择一条订单导出
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
- // 提取订单ID
|
|
|
- let orderSnList = this.multipleSelection.map((item) => item.SN.value || '');
|
|
|
- // 去重
|
|
|
- let orderSnSet = Array.from(new Set(orderSnList))
|
|
|
- if (orderSnSet.length !== 1) {
|
|
|
- this.$message({
|
|
|
- message: 'Only one order can be exported at a time',//每次只能导出一条订单
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- return false
|
|
|
- }
|
|
|
+ // 提取订单ID
|
|
|
+ let orderSnList = this.multipleSelection.map((item) => item.SN.value || '')
|
|
|
+ // 去重
|
|
|
+ let orderSnSet = Array.from(new Set(orderSnList))
|
|
|
+ if (orderSnSet.length !== 1) {
|
|
|
+ this.$message({
|
|
|
+ message: 'Only one order can be exported at a time', // 每次只能导出一条订单
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ return false
|
|
|
+ }
|
|
|
|
|
|
- this.$confirm(`Are you sure you want to export the current data?`, 'Hint', {//`确定要导出当前数据吗?`, '提示'
|
|
|
- confirmButtonText: 'confirm',//确定
|
|
|
- cancelButtonText: 'cancel',//取消
|
|
|
- type: 'info'
|
|
|
- }).then(() => {
|
|
|
- // 导出时只需要订单ID即可
|
|
|
- let orderSn = orderSnSet[0]
|
|
|
- network.getData(`shop/order-list-export-pdf/${orderSn}`).then(response => {
|
|
|
- this.$message({
|
|
|
- message: response,
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- })
|
|
|
- }).catch(response => {
|
|
|
- this.$message({
|
|
|
- message: response,
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- handleEdit() {
|
|
|
- // 进入修改订单页面
|
|
|
- },
|
|
|
- handleDel(row) {
|
|
|
- let orderSn = row.SN.value // order订单表的编号
|
|
|
- this.$confirm(`确定要删除订单:${orderSn}吗?`, '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- // 删除订单
|
|
|
- let postData = {
|
|
|
- orderSn
|
|
|
- }
|
|
|
- return network.postData('shop/delete-order', postData).then(response => {
|
|
|
- console.log(response);
|
|
|
- this.$message({
|
|
|
- message: response,
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
- this.submitButtonStat = false
|
|
|
- this.$router.go(0)
|
|
|
- }).catch(() => {
|
|
|
- this.submitButtonStat = false
|
|
|
+ this.$confirm(`Are you sure you want to export the current data?`, 'Hint', { // `确定要导出当前数据吗?`, '提示'
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'info'
|
|
|
+ }).then(() => {
|
|
|
+ // 导出时只需要订单ID即可
|
|
|
+ let orderSn = orderSnSet[0]
|
|
|
+ network.getData(`shop/order-list-export-pdf/${orderSn}`).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
})
|
|
|
- }).then(response => {
|
|
|
-
|
|
|
- }).catch(response => {
|
|
|
-
|
|
|
})
|
|
|
- },
|
|
|
- // 显示发货对话框
|
|
|
- handleShowDeliveryDialog(row) {
|
|
|
- this.dialogDeliveryVisible = true
|
|
|
- this.deliveryForm.sn = row['SN'].value
|
|
|
- },
|
|
|
- // 发货
|
|
|
- handleDelivery() {
|
|
|
- network.postData('shop/order-delivery', this.deliveryForm).then(response => {
|
|
|
+ }).catch(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleEdit () {
|
|
|
+ // 进入修改订单页面
|
|
|
+ },
|
|
|
+ handleDel (row) {
|
|
|
+ let orderSn = row.SN.value // order订单表的编号
|
|
|
+ this.$confirm(`确定要删除订单:${orderSn}吗?`, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ // 删除订单
|
|
|
+ let postData = {
|
|
|
+ orderSn
|
|
|
+ }
|
|
|
+ return network.postData('shop/delete-order', postData).then(response => {
|
|
|
+ console.log(response);
|
|
|
this.$message({
|
|
|
message: response,
|
|
|
type: 'success'
|
|
|
})
|
|
|
- this.dialogDeliveryVisible = false
|
|
|
- this.getData(this.currentPage, this.pageSize)
|
|
|
- }).catch(response => {
|
|
|
- this.dialogDeliveryVisible = false
|
|
|
+ this.submitButtonStat = false
|
|
|
+ this.$router.go(0)
|
|
|
+ }).catch(() => {
|
|
|
+ this.submitButtonStat = false
|
|
|
})
|
|
|
- },
|
|
|
- // 退款
|
|
|
- handleRefund(orderSn) {
|
|
|
- this.$confirm(`Are you sure you want to refund this order?`, 'Hint', {//`确定要将此订单退款吗?`, '提示',
|
|
|
- confirmButtonText: 'confirm',//确定
|
|
|
- cancelButtonText: 'cancel',//取消
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- return network.postData(`shop/order-refund`, { sn: orderSn.value })
|
|
|
- }).then(response => {
|
|
|
- this.$message({
|
|
|
- message: response,
|
|
|
- type: 'success'
|
|
|
- })
|
|
|
+ }).then(response => {
|
|
|
|
|
|
- this.getData(this.currentPage, this.pageSize)
|
|
|
- }).catch(response => {
|
|
|
- this.$message({
|
|
|
- message: response,
|
|
|
- type: 'error'
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- }
|
|
|
+ }).catch(response => {
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 显示发货对话框
|
|
|
+ handleShowDeliveryDialog (row) {
|
|
|
+ this.dialogDeliveryVisible = true
|
|
|
+ this.deliveryForm.sn = row['SN'].value
|
|
|
+ },
|
|
|
+ // 发货
|
|
|
+ handleDelivery () {
|
|
|
+ network.postData('shop/order-delivery', this.deliveryForm).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.dialogDeliveryVisible = false
|
|
|
+ this.getData(this.currentPage, this.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+ this.dialogDeliveryVisible = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 退款
|
|
|
+ handleRefund (orderSn) {
|
|
|
+ this.$confirm(`Are you sure you want to refund this order?`, 'Hint', {//`确定要将此订单退款吗?`, '提示',
|
|
|
+ confirmButtonText: 'confirm', // 确定
|
|
|
+ cancelButtonText: 'cancel', // 取消
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ return network.postData(`shop/order-refund`, { sn: orderSn.value })
|
|
|
+ }).then(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+
|
|
|
+ this.getData(this.currentPage, this.pageSize)
|
|
|
+ }).catch(response => {
|
|
|
+ this.$message({
|
|
|
+ message: response,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
</script>
|
|
|
|