buy_goods.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. $status = array
  3. (
  4. 1 => '正常',
  5. 2 => '申请退款中',
  6. 3 => '已退款',
  7. );
  8. return array
  9. (
  10. # 表名
  11. 'name' => 'buy_goods',
  12. # 显示给用户看的名称
  13. 'lang' => '订单商品表',
  14. 'menu' => false,
  15. 'status' => $status,
  16. # 数据结构
  17. 'struct' => array
  18. (
  19. 'id' => array
  20. (
  21. 'type' => 'int-11',
  22. 'name' => 'ID',
  23. 'default' => '',
  24. 'desc' => '',
  25. 'match' => 'is_numeric',
  26. 'search' => 'order',
  27. 'update' => 'hidden',
  28. //'list' => true,
  29. ),
  30. 'order_id' => array
  31. (
  32. 'type' => 'int-11',
  33. 'name' => '订单表id',
  34. 'default' => '',
  35. 'desc' => '订单表id',
  36. 'match' => 'is_numeric',
  37. ),
  38. 'seller_id' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => '销售商',
  42. 'default' => '',
  43. 'desc' => '销售商',
  44. 'match' => 'is_numeric',
  45. ),
  46. 'goods_id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => '商品名称',
  50. 'default' => '',
  51. 'desc' => '商品名称',
  52. 'match' => 'is_numeric',
  53. ),
  54. 'sku_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => 'sku_id',
  58. 'default' => '-1',
  59. 'desc' => 'sku_id',
  60. 'match' => 'is_numeric',
  61. ),
  62. 'cash' => array
  63. (
  64. 'type' => 'decimal-11,2',
  65. 'name' => '单价',
  66. 'default' => '',
  67. 'desc' => '单价',
  68. 'match' => 'option',
  69. 'update' => 'text',
  70. 'list' => true,
  71. ),
  72. 'num' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '购买数量',
  76. 'default' => '',
  77. 'desc' => '购买数量',
  78. 'match' => 'is_numeric',
  79. 'search' => 'select',
  80. 'list' => true,
  81. ),
  82. 'pay_cash' => array
  83. (
  84. 'type' => 'decimal-11,2',
  85. 'name' => '支付金额',
  86. 'default' => '',
  87. 'desc' => '支付金额',
  88. 'match' => 'option',
  89. 'update' => 'text',
  90. 'list' => true,
  91. ),
  92. 'wallet_cash' => array
  93. (
  94. 'type' => 'decimal-11,2',
  95. 'name' => '钱包抵扣金额',
  96. 'default' => '0',
  97. 'desc' => '钱包抵扣金额',
  98. 'match' => 'option',
  99. 'update' => 'text',
  100. ),
  101. 'status' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '状态',
  105. 'default' => '1',
  106. 'desc' => '状态',
  107. 'match' => 'is_numeric',
  108. //'update' => 'select',
  109. 'option' => $status,
  110. 'search' => 'select',
  111. 'list' => true,
  112. 'edit' => true,
  113. ),
  114. 'state' => array
  115. (
  116. 'type' => 'tinyint-1',
  117. 'name' => '状态',
  118. 'default' => '1',
  119. 'desc' => '请选择状态',
  120. 'match' => 'is_numeric',
  121. ),
  122. 'cdate' => array
  123. (
  124. 'type' => 'int-11',
  125. 'name' => '创建时间',
  126. 'match' => array('is_numeric', time()),
  127. 'desc' => '',
  128. # 只有insert时才生效
  129. 'insert' => true,
  130. 'search' => 'date',
  131. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  132. ),
  133. ),
  134. 'manage' => array
  135. (
  136. 'insert' => false,
  137. 'delete' => false,
  138. 'page_list' => 'buy_goods',
  139. ),
  140. 'request' => array
  141. (
  142. # 获取总金额
  143. 'getNum' => array
  144. (
  145. # 匹配的正则或函数 选填项
  146. 'option' => array
  147. (
  148. 'start' => array('yes-t_2.cdate', '>='),
  149. 'end' => array('yes-t_2.cdate', '<='),
  150. 'start_o' => array('yes-t_2.operdate', '>='),
  151. 'end_o' => array('yes-t_2.operdate', '<='),
  152. 'shop_id' => array('yes-t_2.shop_id'),
  153. 'goods_id' => array('yes-t_1.goods_id'),
  154. 'status' => array('yes-t_2.status', 'in'),
  155. 'state_2' => 'yes-t_2.state-1',
  156. 'state_1' => 'yes-t_1.state-1',
  157. 'status_1' => 'yes-t_1.status-1',
  158. ),
  159. # 联表
  160. 'join' => array
  161. (
  162. array
  163. (
  164. 'table' => 'shop/sell_order',
  165. 'type' => 'left join',
  166. 'on' => array('order_id','id'),
  167. ),
  168. ),
  169. 'type' => 'all',
  170. 'group' => 't_2.shop_id, t_1.goods_id',
  171. 'col' => 'id,t_2.shop_id, t_1.goods_id,sum(t_1.price*t_1.num) as cash,sum(t_1.num) as num',
  172. ),
  173. ),
  174. );