shelves.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div>
  3. <el-button size="mini" type="primary" @click="onshow">{{data.isonsale === 0?'上 架':'下 架'}}</el-button>
  4. <el-dialog
  5. title="提示"
  6. :visible.sync="upVisible"
  7. width="25%"
  8. append-to-body
  9. >
  10. <span>确定上架该商品组吗</span>
  11. <span slot="footer" class="dialog-footer">
  12. <el-button @click="upVisible = false" size="small">取 消</el-button>
  13. <el-button type="primary" @click="shelvesUp" size="small">确 定</el-button>
  14. </span>
  15. </el-dialog>
  16. <el-dialog
  17. title="提示"
  18. :visible.sync="downVisible"
  19. width="25%"
  20. append-to-body
  21. >
  22. <span>确定下架该商品组吗</span>
  23. <span slot="footer" class="dialog-footer">
  24. <el-button @click="downVisible = false" size="small">取 消</el-button>
  25. <el-button type="primary" @click="shelvesDown" size="small">确 定</el-button>
  26. </span>
  27. </el-dialog>
  28. </div>
  29. </template>
  30. <script>
  31. export default {
  32. name: "shelves",
  33. props:["data"],
  34. data(){
  35. return {
  36. upVisible:false,
  37. downVisible:false
  38. }
  39. },
  40. methods:{
  41. onshow(){
  42. console.log("输出数据")
  43. console.log(this.data)
  44. if (this.data.isonsale === 0){
  45. this.openUp()
  46. }else {
  47. this.openDown()
  48. }
  49. },
  50. openUp() {
  51. this.$confirm('确定上架该商品组吗?', '提示', {
  52. confirmButtonText: '确定',
  53. cancelButtonText: '取消',
  54. closeOnClickModal:false,
  55. type: 'warning'
  56. }).then(() => {
  57. this.shelvesUp()
  58. }).catch(() => {
  59. this.$message({
  60. type: 'info',
  61. message: '已取消上架'
  62. });
  63. });
  64. },
  65. openDown() {
  66. this.$confirm('确定下架该商品组吗?', '提示', {
  67. confirmButtonText: '确定',
  68. cancelButtonText: '取消',
  69. closeOnClickModal:false,
  70. type: 'warning'
  71. }).then(() => {
  72. this.shelvesDown()
  73. }).catch(() => {
  74. this.$message({
  75. type: 'info',
  76. message: '已取消下架'
  77. });
  78. });
  79. },
  80. async shelvesUp(){
  81. const res = await this.$api.requested({
  82. "id": "20220923143603",
  83. "content": {
  84. "sa_itemgroupids":[this.data.sa_itemgroupid]
  85. }
  86. })
  87. this.tool.showMessage(res,()=>{
  88. this.upVisible = false
  89. this.$emit("upSuccess")
  90. })
  91. },
  92. async shelvesDown(){
  93. const res = await this.$api.requested({
  94. "id": "20220923143703",
  95. "content": {
  96. "sa_itemgroupids":[this.data.sa_itemgroupid]
  97. }
  98. })
  99. this.tool.showMessage(res,()=>{
  100. this.downVisible = false
  101. this.$emit("upSuccess")
  102. })
  103. }
  104. },
  105. mounted() {
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. </style>