install.sql 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. CREATE TABLE `qimall_addons_secondary_card`
  2. (
  3. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  4. `mall_id` int(10) unsigned NOT NULL,
  5. `name` varchar(150) NOT NULL DEFAULT '' COMMENT '次卡名称',
  6. `font_color` varchar(255) NOT NULL DEFAULT '' COMMENT '字体颜色',
  7. `background_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '次卡背景类型,0:默认背景,1:自定义',
  8. `background` varchar(255) NOT NULL DEFAULT '' COMMENT '次卡背景',
  9. `total_redemption` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '累计兑卡张数',
  10. `total_sales` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '累计售卡数',
  11. `total_sales_price` decimal(14, 2) unsigned NOT NULL DEFAULT '0.00' COMMENT '累计售卡金额',
  12. `sell_time_start` int(11) NOT NULL DEFAULT '0' COMMENT '售卖开始时间',
  13. `sell_time_end` int(11) NOT NULL DEFAULT '0' COMMENT '售卖结束时间',
  14. `expire_type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '次卡有效期类型:1=购买时起N天内有效,2=指定有效期',
  15. `begin_at` varchar(255) NOT NULL DEFAULT '' COMMENT '有效期开始时间',
  16. `end_at` varchar(255) NOT NULL DEFAULT '' COMMENT '有效期结束时间',
  17. `expire_day` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '有效天数,expire_type=1时',
  18. `price` decimal(12, 2) unsigned DEFAULT '0.00' COMMENT '售价',
  19. `original_price` decimal(12, 2) unsigned DEFAULT '0.00' COMMENT '原价',
  20. `verifiable_times` bigint(20) unsigned DEFAULT '0' COMMENT '可核销次数',
  21. `max_times` bigint(20) unsigned DEFAULT '0' COMMENT '最大开卡数',
  22. `virtual_sales` bigint(20) unsigned DEFAULT '0' COMMENT '虚拟销量',
  23. `service` text COMMENT '卡服务设置',
  24. `reservation_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要预约,0:不需要,1:需要',
  25. `reservation_model` tinyint(1) NOT NULL DEFAULT '1' COMMENT '预约模式:1:预约门店;2:预约服务人',
  26. `reservation_service_type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '服务方式:1:上门服务;2:到店服务;3:上门/到店',
  27. `reservation_day` varchar(255) NOT NULL DEFAULT '' COMMENT '可预约日期:0-6对应周日至周六',
  28. `reservation_time_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '可预约时间段类型:1:指定时间段;2:整天',
  29. `reservation_time` text COMMENT '预约时间段',
  30. `appointment_interval_duration` int(11) NOT NULL DEFAULT '0' COMMENT '项目时间',
  31. `reservation_cancel_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '预约取消:1:不允许取消;2:服务开始前N小时,取消并扣除m次可服务数',
  32. `reservation_cancel_hour` int(11) NOT NULL DEFAULT '0' COMMENT '服务开始前N小时',
  33. `reservation_cancel_deduct` int(11) NOT NULL DEFAULT '0' COMMENT '取消并扣除m次可服务数',
  34. `reservation_limit_people` int(11) NOT NULL DEFAULT '0' COMMENT '同时段可预约N人',
  35. `reservation_limit_repeat` int(11) NOT NULL DEFAULT '0' COMMENT '反复预约限制N次',
  36. `refund_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '退款类型,0:未使用到期自动退,1:不允许退款,2:允许退款',
  37. `limit_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '限购类型,0:不限开卡次数(用户可重复开卡,不限制领卡次数),1:有效期内限开卡次数',
  38. `limit_times` int(11) NOT NULL DEFAULT '0' COMMENT 'limit_type==1,次数,领取次数仅统计用户领卡的次数,不统计商家发卡',
  39. `create_source_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '创建来源类型:0:平台;1:门店',
  40. `create_source_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建来源id',
  41. `is_on_sales` tinyint(1) NOT NULL DEFAULT '1' COMMENT '卡次状态:0:下架;1:正常',
  42. `rule` text COMMENT '使用规则',
  43. `store_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '店铺类型:1:o2o门店',
  44. `use_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '使用范围:0:全部店铺;1:指定店铺',
  45. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  46. `created_at` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  47. `updated_at` bigint(20) unsigned NOT NULL DEFAULT '0',
  48. `applet_code` varchar(255) NOT NULL DEFAULT '' COMMENT '小程序推广码',
  49. PRIMARY KEY (`id`) USING BTREE,
  50. KEY `idx_mall_id` (`mall_id`) USING BTREE
  51. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='次卡';
  52. CREATE TABLE `qimall_addons_secondary_card_order`
  53. (
  54. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  55. `mall_id` int(10) unsigned NOT NULL,
  56. `user_id` int(11) unsigned NOT NULL COMMENT '会员id',
  57. `secondary_card_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '次卡id',
  58. `use_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '使用范围:0:全部店铺;1:指定店铺',
  59. `order_no` varchar(255) NOT NULL DEFAULT '' COMMENT '次卡号',
  60. `clerk_code` varchar(12) NOT NULL DEFAULT '' COMMENT '核销码',
  61. `order_status` tinyint(1) DEFAULT '0' COMMENT '状态:0:待核销;1:已失效;2:已过期;3:已退款;4:已停卡',
  62. `open_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '开卡时间:需要支付时,支付时间',
  63. `open_type` tinyint(20) unsigned NOT NULL DEFAULT '1' COMMENT '开卡方式:1:下单购买;2:兑换码兑换',
  64. `pay_money` decimal(12, 2) unsigned NOT NULL DEFAULT '0.00' COMMENT '购卡实收金额',
  65. `pay_type` int(1) NOT NULL DEFAULT '0' COMMENT '支付方式:1=微信支付,2=货到付款,3=余额支付,4=支付宝支付,5=银联支付,6=汇聚聚合支付,7=汇聚快捷支付',
  66. `expire_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
  67. `refund_source` tinyint(1) NOT NULL DEFAULT '0' COMMENT '退款来源:1:会员申请;2:过期,后台操作退款',
  68. `refund_money` decimal(12, 2) unsigned NOT NULL DEFAULT '0.00' COMMENT '退款金额',
  69. `refund_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '退款时间',
  70. `verifiable_times` int(11) NOT NULL DEFAULT '0' COMMENT '可核销次数',
  71. `code` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换码',
  72. `status` tinyint(1) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  73. `created_at` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  74. `updated_at` bigint(20) unsigned NOT NULL DEFAULT '0',
  75. `trade_id` int(11) NOT NULL DEFAULT '0' COMMENT '流水表ID',
  76. `start_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '有效期开始时间',
  77. `create_source_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '创建来源类型:0:平台;1:门店',
  78. `create_source_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建来源id',
  79. PRIMARY KEY (`id`) USING BTREE,
  80. KEY `idx_mall_id` (`mall_id`) USING BTREE,
  81. KEY `idx_secondary_card_id` (`secondary_card_id`) USING BTREE,
  82. KEY `idx_order_no` (`order_no`) USING BTREE,
  83. KEY `idx_clerk_code` (`clerk_code`) USING BTREE,
  84. KEY `idx_trade_id` (`trade_id`) USING BTREE
  85. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='开卡记录';
  86. CREATE TABLE `qimall_addons_secondary_card_redemption_code`
  87. (
  88. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  89. `mall_id` int(10) unsigned NOT NULL,
  90. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
  91. `code` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换码',
  92. `remarks` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
  93. `secondary_card_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '次卡id',
  94. `is_use` tinyint(1) DEFAULT '0' COMMENT '状态:0:未使用;1:已使用',
  95. `use_time` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '使用时间',
  96. `order_no` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换次卡号',
  97. `status` tinyint(1) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  98. `created_at` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  99. `updated_at` bigint(20) unsigned NOT NULL DEFAULT '0',
  100. `use_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '使用范围:0:全部店铺;1:指定店铺',
  101. `create_source_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '创建来源类型:0:平台;1:门店',
  102. `create_source_id` int(11) NOT NULL DEFAULT '0' COMMENT '创建来源id',
  103. PRIMARY KEY (`id`) USING BTREE,
  104. KEY `idx_mall_id` (`mall_id`) USING BTREE,
  105. KEY `idx_secondary_card_id` (`secondary_card_id`) USING BTREE,
  106. KEY `idx_mall_id_code` (`mall_id`,`code`) USING BTREE
  107. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='兑换码管理';
  108. CREATE TABLE `qimall_addons_secondary_card_relate_store`
  109. (
  110. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  111. `mall_id` int(10) unsigned NOT NULL,
  112. `create_source_type` tinyint(3) NOT NULL DEFAULT '0' COMMENT '创建来源类型:0:平台;1:门店',
  113. `store_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '店铺类型:1:o2o门店',
  114. `secondary_card_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '次卡id',
  115. `store_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  116. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  117. `created_at` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  118. `updated_at` bigint(20) unsigned NOT NULL DEFAULT '0',
  119. PRIMARY KEY (`id`) USING BTREE,
  120. KEY `idx_mall_id` (`mall_id`) USING BTREE,
  121. KEY `idx_secondary_card_id` (`secondary_card_id`) USING BTREE,
  122. KEY `idx_secondary_type_store_id` (`store_type`,`store_id`) USING BTREE
  123. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='次卡关联门店';
  124. CREATE TABLE `qimall_addons_secondary_card_reservation_service`
  125. (
  126. `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  127. `mall_id` int(10) unsigned NOT NULL COMMENT '商城ID',
  128. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  129. `secondary_card_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '绑定的次卡ID',
  130. `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态0禁用,-1删除,1正常',
  131. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  132. `updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  133. PRIMARY KEY (`id`) USING BTREE,
  134. KEY `user_id` (`user_id`) USING BTREE,
  135. KEY `secondary_card_id` (`secondary_card_id`) USING BTREE
  136. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='技师绑定的次卡项目';
  137. CREATE TABLE `qimall_addons_secondary_card_use_log`
  138. (
  139. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  140. `mall_id` int(10) unsigned NOT NULL,
  141. `user_id` int(11) unsigned NOT NULL COMMENT '会员id',
  142. `order_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'order_id',
  143. `secondary_card_id` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '次卡id',
  144. `order_no` varchar(255) NOT NULL DEFAULT '' COMMENT '兑换次卡号',
  145. `clerk_nums` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '单次核销数',
  146. `type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '类型:1:o2o门店;',
  147. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '核销门店id',
  148. `status` tinyint(1) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  149. `open_time` int(11) NOT NULL DEFAULT '0' COMMENT '开卡时间',
  150. `created_at` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  151. `updated_at` bigint(20) unsigned NOT NULL DEFAULT '0',
  152. `clerk_money` decimal(12, 2) NOT NULL DEFAULT '0.00' COMMENT '订单核销金额',
  153. `clerk_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销人user_id',
  154. `reservation_service_order_id` int(11) NOT NULL DEFAULT '0' COMMENT '预约服务插件,服务订单id',
  155. `service_income` decimal(12, 2) NOT NULL DEFAULT '0.00' COMMENT '技师服务收入',
  156. `clerk_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '核销类型:1:门店核销;2:技师核销',
  157. `clerk_log_id` int(11) NOT NULL DEFAULT '0' COMMENT '公共核销记录id',
  158. PRIMARY KEY (`id`) USING BTREE,
  159. KEY `idx_mall_id` (`mall_id`) USING BTREE,
  160. KEY `idx_secondary_card_id` (`secondary_card_id`) USING BTREE,
  161. KEY `idx_order_id` (`order_id`) USING BTREE,
  162. KEY `idx_reservation_service_order_id` (`reservation_service_order_id`) USING BTREE
  163. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用记录';