CREATE TABLE `qimall_addons_purchase_cate`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `mall_id` int(11) NOT NULL,
    `parent_id` int(11) NOT NULL DEFAULT 0 COMMENT '父级ID',
    `name` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '分类名称',
    `pic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
    `big_pic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
    `advert_pic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '广告图片',
    `advert_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '广告链接',
    `advert_open_type` varchar(65) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '打开方式',
    `advert_params` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '导航参数',
    `is_show` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否显示',
    `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[0禁用 1启用 -1删除]',
    `sort` int(11) NOT NULL DEFAULT 999 COMMENT '排序',
    `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
    `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `mall_id`(`mall_id`) USING BTREE,
    INDEX `parent_id`(`parent_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品分类表' ROW_FORMAT = Compact;

CREATE TABLE `qimall_addons_purchase_goods`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `mall_id` int(11) NOT NULL DEFAULT 0,
    `goods_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品ID',
    `exchange_price` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '兑换价说明',
    `exchange_num` int(11) NOT NULL DEFAULT 0 COMMENT '已兑换数量',
    `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
    `created_at` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
    `updated_at` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `mall_id`(`mall_id`) USING BTREE,
    INDEX `cate_id`(`exchange_price`) USING BTREE,
    INDEX `goods_id`(`goods_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购专区商品表' ROW_FORMAT = Dynamic;

CREATE TABLE `qimall_addons_purchase_goods_attr`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `goods_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品ID',
    `goods_attr_id` int(11) NOT NULL DEFAULT 0 COMMENT '规格ID',
    `min_score` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '最低抵扣积分',
    `min_limit` tinyint(1) NULL DEFAULT 0 COMMENT '是否限制[0=不限制，1=限制]',
    `max_score` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '最高抵扣积分',
    `max_limit` tinyint(1) NULL DEFAULT 0 COMMENT '是否限制[0=不限制，1=限制]',
    `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
    `created_at` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
    `updated_at` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `goods_id`(`goods_id`) USING BTREE,
    INDEX `goods_attr_id`(`goods_attr_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '采购专区商品规格表' ROW_FORMAT = Dynamic;

CREATE TABLE `qimall_addons_purchase_goods_cate_relate`  (
    `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
    `cate_id` int(10) NULL DEFAULT 0 COMMENT '分类id',
    `goods_id` int(10) NULL DEFAULT 0 COMMENT '产品id',
    `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
    `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
    PRIMARY KEY (`id`) USING BTREE,
    INDEX `cate_id`(`cate_id`) USING BTREE,
    INDEX `goods_id`(`goods_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品分类关联表' ROW_FORMAT = Dynamic;

CREATE TABLE `qimall_addons_purchase_manager`  (
   `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
   `mall_id` int(10) NULL DEFAULT 0 COMMENT '商城ID',
   `user_id` int(10) NULL DEFAULT 0 COMMENT '会员ID',
   `mobile` bigint(20) NULL DEFAULT 0 COMMENT '手机号码',
   `apply_uid` int(10) NULL DEFAULT 0 COMMENT '申请人',
   `license` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '营业执照',
   `store_info` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '店铺抬头',
   `idcart_front` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证照(正)',
   `idcart_back` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '身份证照(反)',
   `idcart_hands` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '身份证照(手持)',
   `is_poss` tinyint(1) NOT NULL DEFAULT 0 COMMENT '审核状态[0审核中 1审核通过 -1拒绝]',
   `reason` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '失败原因',
   `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[0禁用 1启用 -1删除]',
   `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
   `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
   PRIMARY KEY (`id`) USING BTREE,
   INDEX `mall_id`(`mall_id`) USING BTREE,
   INDEX `user_id`(`user_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '店长表' ROW_FORMAT = Dynamic;

INSERT INTO `qimall_global_var_map`(`name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('Purchase', '采购专区', 'MarketingTypeMap', 1, 1, 1654569888, 1654569888);

