shop_stat.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <?php
  2. $button = array();
  3. $excel = false;
  4. if (Dever::load('manage/auth')->checkFunc('bill.shop_stat', 'editSout', '导出数据')) {
  5. $excel[] = array('数据导出','归店数据统计','bill/lib/manage.out_shop_stat');
  6. }
  7. $shop = function()
  8. {
  9. $array = array();
  10. $data = Dever::db('shop/info-state');
  11. if($data)
  12. {
  13. $array += $data;
  14. }
  15. return $array;
  16. };
  17. $cash_status = array
  18. (
  19. 1 => '已发放',
  20. 2 => '未发放',
  21. );
  22. $status = array
  23. (
  24. 1 => '已确认',
  25. 2 => '未确认',
  26. );
  27. $list_button = array();
  28. $list_button['list1'] = array('归店明细', 'member_shop_log&project=agent&menu=agent&search_option_state=1&menu_id=306&search_option_new_shop_id={shop_id}&search_option_dever_auth=2&search_option_status=1');
  29. $list_button['list2'] = array('直推明细', 'order&project=agent&menu=agent&search_option_state=1&menu_id=306&search_in_parent_mid={mids}');
  30. $table = Dever::input('table');
  31. if ($table == 'shop_stat') {
  32. $month = Dever::input('search_option_month', date('Y-m'));
  33. if ($month) {
  34. Dever::setInput('search_option_month', $month);
  35. }
  36. $button['一键生成归店信息'] = array('oper', 'bill/?l=lib/Cron.shop_stat&day=' . $month, '确认生成归店统计信息吗?');
  37. $button['重新生成归店信息'] = array('oper', 'bill/?l=lib/Cron.shop_stat&day=' . $month, '确认生成归店统计信息吗?');
  38. if (Dever::load('manage/auth')->checkFunc('bill.shop_stat', 'duizhang', '对账确认')) {
  39. $button['对账确认'] = array('oper', 'bill/?l=lib/cron.shopYes_commit&month=' . $month, '确定已完成对账?');
  40. }
  41. if (Dever::load('manage/auth')->checkFunc('bill.shop_stat', 'fafang', '确认发放')) {
  42. $button['确认发放'] = array('oper', 'bill/?l=lib/cron.areaCash_commit&month=' . $month, '确认发放资金到代理商账户吗?确认后无法手动恢复');
  43. }
  44. }
  45. $config = array
  46. (
  47. # 表名
  48. 'name' => 'shop_stat',
  49. # 显示给用户看的名称
  50. 'lang' => '归店统计',
  51. 'order' => -10,
  52. 'info' => '代理商总数=创V数+代理商数量,创V数包含名额外创V数,创V数减去名额外创V就是名额内创V数,代理商数量包含创客数',
  53. 'end' => array
  54. (
  55. 'list' => 'bill/lib/cron.getShopInfo',
  56. ),
  57. # 数据结构 不同的字段放这里
  58. 'struct' => array
  59. (
  60. 'id' => array
  61. (
  62. 'type' => 'int-11',
  63. 'name' => 'ID',
  64. 'default' => '',
  65. 'desc' => '',
  66. 'match' => 'is_numeric',
  67. //'list' => true,
  68. ),
  69. 'month' => array
  70. (
  71. 'type' => 'int-11',
  72. 'name' => '月份',
  73. 'default' => '',
  74. 'match' => 'is_numeric',
  75. 'desc' => '',
  76. 'search' => 'month_eq',
  77. // 'list_name' => '月份',
  78. 'search_default' => '',
  79. 'list_name' => '月份',
  80. 'list' => 'is_numeric("{month}") ? date("Y-m", "{month}") : "{month}"',
  81. ),
  82. 'mids' => array
  83. (
  84. 'type' => 'text-255',
  85. 'name' => '代理商id',
  86. 'default' => '',
  87. 'desc' => '代理商id',
  88. 'match' => 'is_numeric',
  89. // 'option' => $shop,
  90. // 'list' => true,
  91. //'list_order' => 6,
  92. ),
  93. 'month_mids' => array
  94. (
  95. 'type' => 'text-255',
  96. 'name' => '代理商id',
  97. 'default' => '',
  98. 'desc' => '代理商id',
  99. 'match' => 'is_numeric',
  100. // 'option' => $shop,
  101. // 'list' => true,
  102. //'list_order' => 6,
  103. ),
  104. 'shop_id' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '店铺名称/店铺编号',
  108. 'default' => '',
  109. 'desc' => '店铺名称',
  110. 'match' => 'is_numeric',
  111. 'option' => $shop,
  112. 'search' => array
  113. (
  114. 'api' => 'shop/info-getSearch',
  115. 'col' => 'col',
  116. 'result' => 'id',
  117. ) ,
  118. 'list_name' => '门店名称<br/>门店编号<br/>所属代理商',
  119. 'list' => 'Dever::load("bill/lib/manage.shop_stat", {id})',
  120. 'list_order' => 2,
  121. ),
  122. 'dl_subsidy' => array
  123. (
  124. 'type' => 'decimal-11,2',
  125. 'name' => '区域招商补贴',
  126. 'default' => '0',
  127. 'desc' => '补贴',
  128. 'match' => 'is_numeric',
  129. 'update' => 'text',
  130. 'list' => true,
  131. 'list_order' => 3,
  132. ),
  133. 'v_subsidy' => array
  134. (
  135. 'type' => 'decimal-11,2',
  136. 'name' => '名额外创V补贴',
  137. 'default' => '0',
  138. 'desc' => '补贴',
  139. 'match' => 'is_numeric',
  140. 'update' => 'text',
  141. 'list' => true,
  142. 'list_order' => 3,
  143. ),
  144. 'c_money' => array
  145. (
  146. 'type' => 'decimal-11,2',
  147. 'name' => '采购金额',
  148. 'default' => '0',
  149. 'desc' => '采购金额',
  150. 'match' => 'is_numeric',
  151. 'update' => 'text',
  152. 'list' => true,
  153. 'list_order' => 3,
  154. ),
  155. 'num' => array
  156. (
  157. 'type' => 'int-11',
  158. 'name' => '代理商总数量',
  159. 'default' => '0',
  160. 'desc' => '代理商总数量',
  161. 'match' => 'is_numeric',
  162. 'search' => 'order',
  163. // 'list' => true,
  164. ),
  165. 'dl_num' => array
  166. (
  167. 'type' => 'int-11',
  168. 'name' => '代理商<br/>数量-除掉创v的数量',
  169. 'default' => '0',
  170. 'desc' => '代理商数量',
  171. 'match' => 'is_numeric',
  172. // 'search' => 'order',
  173. 'list' => true,
  174. 'list_order' => 4,
  175. ),
  176. 'ck_num' => array
  177. (
  178. 'type' => 'int-11',
  179. 'name' => '创客数',
  180. 'default' => '0',
  181. 'desc' => '创客数',
  182. 'match' => 'is_numeric',
  183. // 'search' => 'order',
  184. 'list' => true,
  185. 'list_order' => 5,
  186. ),
  187. 'v_num' => array
  188. (
  189. 'type' => 'int-11',
  190. 'name' => '创V数',
  191. 'default' => '0',
  192. 'desc' => '创V总数量',
  193. 'match' => 'is_numeric',
  194. // 'search' => 'order',
  195. 'list' => true,
  196. 'list_order' => 6,
  197. ),
  198. 'out_num' => array
  199. (
  200. 'type' => 'int-11',
  201. 'name' => '名额外创V数',
  202. 'default' => '0',
  203. 'desc' => '创V名额外数量',
  204. 'match' => 'is_numeric',
  205. // 'search' => 'order',
  206. 'list' => true,
  207. 'list_order' => 7,
  208. ),
  209. 'money' => array
  210. (
  211. 'type' => 'decimal-11,2',
  212. 'name' => '代理商的总业绩',
  213. 'default' => '0',
  214. 'desc' => '代理商的总业绩',
  215. 'match' => 'is_numeric',
  216. 'update' => 'text',
  217. // 'list' => true,
  218. ),
  219. 'dl_money' => array
  220. (
  221. 'type' => 'decimal-11,2',
  222. 'name' => '归店业绩<br/>(除创V)',
  223. 'default' => '0',
  224. 'desc' => '代理商业绩',
  225. 'match' => 'is_numeric',
  226. 'update' => 'text',
  227. 'list' => true,
  228. 'list_order' => 4,
  229. ),
  230. 'v_money' => array
  231. (
  232. 'type' => 'decimal-11,2',
  233. 'name' => '创V总业绩',
  234. 'default' => '0',
  235. 'desc' => '创V总业绩',
  236. 'match' => 'is_numeric',
  237. 'update' => 'text',
  238. // 'list' => true,
  239. ),
  240. 'out_money' => array
  241. (
  242. 'type' => 'decimal-11,2',
  243. 'name' => '名额外创V<br/>业绩',
  244. 'default' => '0',
  245. 'desc' => '创V名额外业绩',
  246. 'match' => 'is_numeric',
  247. 'update' => 'text',
  248. 'list' => true,
  249. 'list_order' => 8,
  250. ),
  251. 'nei_money' => array
  252. (
  253. 'type' => 'decimal-11,2',
  254. 'name' => '名额内创V<br/>业绩',
  255. 'default' => '0',
  256. 'desc' => '创V名额内业绩',
  257. 'match' => 'is_numeric',
  258. 'update' => 'text',
  259. // 'list' => true,
  260. // 'list_order' => 9,
  261. ),
  262. 'status' => array
  263. (
  264. 'type' => 'int-11',
  265. 'name' => '确认状态',
  266. 'default' => '2',
  267. 'desc' => '确认状态',
  268. 'match' => 'is_numeric',
  269. 'option' => $status,
  270. 'list' => true,
  271. ),
  272. 'cash_status' => array
  273. (
  274. 'type' => 'int-11',
  275. 'name' => '发放状态',
  276. 'default' => '2',
  277. 'desc' => '发放状态',
  278. 'match' => 'is_numeric',
  279. 'option' => $cash_status,
  280. 'list' => true,
  281. ),
  282. 'state' => array
  283. (
  284. 'type' => 'tinyint-1',
  285. 'name' => '数据状态',
  286. 'default' => '1',
  287. 'desc' => '请选择状态',
  288. 'match' => 'is_numeric',
  289. ),
  290. 'cdate' => array
  291. (
  292. 'type' => 'int-11',
  293. 'name' => '发布时间',
  294. 'match' => array('is_numeric', time()),
  295. 'desc' => '',
  296. # 只有insert时才生效
  297. 'insert' => true,
  298. //'search' => 'date',
  299. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  300. ),
  301. ),
  302. 'manage' => array
  303. (
  304. 'insert' => false,
  305. 'edit' => false,
  306. 'delete' => false,
  307. 'excel' => $excel,
  308. 'button' => $button,
  309. 'list_button' => $list_button,
  310. // (
  311. // 'new' => array('查看明细', '"lib/manage.guidian?id={id}"', 'bill'),
  312. // ),
  313. ),
  314. # request 请求接口定义
  315. 'request' => array
  316. (
  317. 'getState' => array
  318. (
  319. # 匹配的正则或函数 选填项
  320. 'option' => array
  321. (
  322. 'start' => array('yes-month', '>='),
  323. 'end' => array('yes-month', '<='),
  324. 'shop_id' => 'yes',
  325. 'state' => 1,
  326. ),
  327. 'type' => 'all',
  328. 'col' => '*',
  329. ),
  330. ),
  331. );
  332. return $config;