12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <template>
- <div class='deviceSell'>
- <div class='plr15 ptb20 c-333 c-f14 bgc-fff c-border-b flex f_y_c f_x_s'>
- <div>当前售货状态:<span>{{status? '在售' : '停售'}}</span></div>
- <van-switch @change="switchSell" inactive-color='#ccc' active-color='#17b3ec' v-model="status" />
- </div>
- </div>
- </template>
- <script>
- import medicineAbinetApi from '@/api/api-medicineAbinet'
- export default{
- name: 'deviceSell',
- data(){
- return {
- status: this.$route.query.status==1,
- }
- },
- created(){
-
- },
- methods:{
- switchSell(flag){
- this.$dialog.confirm({
- title: '',
- message: '确认进行该操作?',
- })
- .then(() => {
- this.$loading('保存中')
- var p = {
- deviceId: this.$route.query.id,
- saleStatus: flag? 1 : 2
- }
- medicineAbinetApi
- .updateSaleStatus(p)
- .then(res => {
- this.$emitRefreshPage('deviceDetail')
- this.$emitRefreshPage('deviceIndex')
- this.$toast('操作成功')
- })
- .catch(err=>{
- console.error(err)
- })
- })
- .catch(err=>{
- this.status = !flag
- })
- },
- }
- }
- </script>
- <style scoped lang='scss'>
- .deviceSell{
- }
- </style>
|