import request from '@/utils/request'
import { URL } from '@/config'

/**
 * @name 获取用户地址列表
 * @api api_url + '/admin/shop/shop-user-delivery-address/list'
 * @param {
  * user_id: 10068
  * pageNum: 1
  * pageSize: 200
 *} 
 * @returns {
    "total": 1,
    "records": 1,
    "page": 1,
    "items": [
        {
            "ud_id": 18,
            "user_id": 10068,
            "ud_name": "啊啊啊",
            "ud_intl": "+86",
            "ud_mobile": "17606216204",
            "ud_telephone": "",
            "ud_contacter": "",
            "ud_im": "",
            "ud_province_id": 110000,
            "ud_province": "北京",
            "ud_city_id": 110100,
            "ud_city": "北京市",
            "ud_county_id": 110101,
            "ud_county": "东城区",
            "ud_address": "aaa",
            "ud_postalcode": "",
            "ud_tag_name": "0",
            "ud_longitude": "0",
            "ud_latitude": "0",
            "ud_time": "2024-10-02 15:22:04",
            "ud_is_default": 0,
            "district_info": "北京/北京市/东城区"
        }
    ]
}
 */

export function getList(params) {
  return request({
    url: URL.shop.user.delivery.address.getList,
    method: 'get',
    params,
  })
}

export function getAddressList(params) {
  return request({
    url: URL.shop.user.delivery.address.getAddressList,
    method: 'get',
    params,
  })
}

/**
 * @name 编辑用户信息
 * @api 
 * @param {
 * user_id: 10068
  *  ud_name: ss
  *  ud_mobile: 18655554444
  *  ud_address: 444
  *  ud_postalcode: 537200
  *  ud_city_id: 340100
  *  ud_city: 合肥市
  *  ud_county_id: 340102
  *  ud_county: 瑶海区
  *  ud_province_id: 340000
  *  ud_province: 安徽省
 * }
 */

export function doEdit(data) {
  return request({
    url: URL.shop.user.delivery.address.doEdit,
    method: 'post',
    data,
  })
}
