acdr-ui/dist/dev/mp-weixin/pages/address/index.js.map

1 line
6.8 KiB
Plaintext

{"version":3,"file":"index.js","sources":["../../../../../src/pages/address/index.vue","../../../../../uniPage:/cGFnZXMvYWRkcmVzcy9pbmRleC52dWU"],"sourcesContent":["<route lang=\"json5\">\r\n{\r\n style: {\r\n navigationBarTitleText: '新增地址',\r\n },\r\n}\r\n</route>\r\n<template>\r\n <view class=\"address-management\">\r\n <view v-for=\"(address, index) in addresses\" :key=\"index\" class=\"address-cell\">\r\n <view class=\"address-info\">\r\n <view class=\"address-label\">\r\n <view class=\"tag\">{{ address.type }}</view>\r\n <view class=\"address-detail\">\r\n {{ address.name }} {{ address.phone }} -\r\n {{ `${address['province']}-${address['city']}-${address['district']}` }}\r\n </view>\r\n </view>\r\n </view>\r\n <view class=\"address-actions\">\r\n <wd-icon name=\"edit\" size=\"20px\" @click=\"editAddress(index)\" />\r\n <wd-icon name=\"delete\" size=\"20px\" @click=\"deleteAddress(index)\" />\r\n </view>\r\n </view>\r\n <wd-status-tip v-if=\"addresses.length == 0\" image=\"content\" tip=\"暂无内容\" />\r\n <!-- 新增地址按钮 -->\r\n <button class=\"add-address-button\" @click=\"addAddress\">新增地址</button>\r\n\r\n <!-- 弹窗组件 -->\r\n <wd-popup\r\n v-model=\"showPopup\"\r\n position=\"bottom\"\r\n custom-style=\"height: 60%; width: 100%;\"\r\n @close=\"handleClose\"\r\n >\r\n <AddAddress :initialAddress=\"currentAddress\" @save-address=\"saveAddress\" />\r\n </wd-popup>\r\n </view>\r\n</template>\r\n\r\n<script setup>\r\nimport { ref, onMounted } from 'vue'\r\nimport AddAddress from './components/AddAddress.vue'\r\nimport { httpGet, httpPost } from '@/utils/http'\r\n\r\n// 地址列表数据\r\nconst addresses = ref([])\r\n\r\n// 当前操作的地址数据\r\nconst currentAddress = ref({\r\n id: null,\r\n name: '',\r\n phone: '',\r\n address: '',\r\n})\r\n\r\n// 控制弹窗的显示\r\nconst showPopup = ref(false)\r\n\r\n// 获取地址列表\r\nconst fetchAddresses = async () => {\r\n const res = await httpPost('/china-address/page')\r\n addresses.value = res.records\r\n}\r\n\r\n// 页面加载时获取地址列表\r\nonMounted(() => {\r\n fetchAddresses()\r\n})\r\n\r\n// 新增地址\r\nconst addAddress = () => {\r\n currentAddress.value = { id: null, name: '', phone: '', address: '' }\r\n showPopup.value = true\r\n}\r\n\r\n// 编辑地址\r\nconst editAddress = (index) => {\r\n const address = addresses.value[index]\r\n addresses.value[index].address = `${address.province}-${address.city}-${address.district}`\r\n currentAddress.value = { ...addresses.value[index] }\r\n showPopup.value = true\r\n}\r\n\r\n// 保存地址(新增或修改)\r\nconst saveAddress = async (address) => {\r\n let res\r\n if (address.address != '') {\r\n const addressList = address.address.split('-')\r\n address.province = addressList[0]\r\n address.city = addressList[1]\r\n address.district = addressList[2]\r\n }\r\n if (address.id) {\r\n // 修改地址\r\n res = await httpPost('/china-address/modify', address)\r\n } else {\r\n // 新增地址\r\n res = await httpPost('/china-address/add', address)\r\n }\r\n if (res.code == 200) {\r\n uni.showToast({ title: '操作成功', icon: '' })\r\n fetchAddresses() // 刷新地址列表\r\n showPopup.value = false\r\n }\r\n}\r\n\r\n// 删除地址\r\nconst deleteAddress = async (index) => {\r\n const addressId = addresses.value[index].id\r\n uni.showModal({\r\n title: '确认删除',\r\n content: '你确定要删除这个地址吗?',\r\n success: async (res) => {\r\n if (res.confirm) {\r\n const deleteRes = await httpGet(`/china-address/remove/${addressId}`)\r\n if (deleteRes.code === 200) {\r\n uni.showToast({ title: '删除成功', icon: 'success' })\r\n fetchAddresses() // 刷新地址列表\r\n }\r\n }\r\n },\r\n })\r\n}\r\n</script>\r\n\r\n<style scoped>\r\n.address-management {\r\n padding: 20px;\r\n}\r\n\r\n.address-cell {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n padding: 10px;\r\n border-bottom: 1px solid #eee;\r\n}\r\n\r\n.address-info {\r\n display: flex;\r\n flex: 1;\r\n align-items: center;\r\n}\r\n\r\n.address-label {\r\n display: flex;\r\n align-items: center;\r\n}\r\n\r\n.tag {\r\n padding: 2px 5px;\r\n margin-right: 10px;\r\n color: white;\r\n background-color: #f5a623;\r\n border-radius: 3px;\r\n}\r\n\r\n.address-detail {\r\n flex-grow: 1;\r\n}\r\n\r\n.address-actions {\r\n display: flex;\r\n gap: 10px; /* Ensure space between icons */\r\n align-items: center;\r\n}\r\n\r\n.wd-icon {\r\n color: #333; /* Adjust color as needed */\r\n cursor: pointer;\r\n}\r\n\r\n.add-address-button {\r\n position: absolute;\r\n bottom: 30px;\r\n left: 50%;\r\n width: 90%;\r\n min-height: 50px;\r\n cursor: pointer;\r\n background-color: #fcd038 !important;\r\n border: none;\r\n transform: translateX(-50%);\r\n}\r\n\r\n.wd-popup {\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/pages/address/index.vue'\nwx.createPage(MiniProgramPage)"],"names":["ref","httpPost","onMounted","uni","httpGet"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAA,aAAA,MAAA;;;;AAIA,UAAA,YAAAA,cAAA,IAAA,EAAA;AAGA,UAAA,iBAAAA,cAAAA,IAAA;AAAA,MACA,IAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,MACA,SAAA;AAAA,IACA,CAAA;AAGA,UAAA,YAAAA,cAAA,IAAA,KAAA;AAGA,UAAA,iBAAA,MAAA;AACA,YAAA,MAAA,MAAAC,WAAA,SAAA,qBAAA;AACA,gBAAA,QAAA,IAAA;AAAA,IACA;AAGAC,kBAAAA,UAAA,MAAA;AACA,qBAAA;AAAA,IACA,CAAA;AAGA,UAAA,aAAA,MAAA;AACA,qBAAA,QAAA,EAAA,IAAA,MAAA,MAAA,IAAA,OAAA,IAAA,SAAA,GAAA;AACA,gBAAA,QAAA;AAAA,IACA;AAGA,UAAA,cAAA,CAA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