buy_order.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <?php
  2. $status = array
  3. (
  4. 1 => '待支付',
  5. 2 => '待审核',
  6. 3 => '待发货',
  7. 4 => '待收货确认',
  8. 5 => '已完成',
  9. 6 => '已完成(有退款)',
  10. 7 => '已取消',
  11. 8 => '已退款',
  12. 11 => '已过期',
  13. );
  14. $refund_status = array
  15. (
  16. 1 => '未申请',
  17. 2 => '已申请',
  18. );
  19. $type = Dever::config('base')->source;
  20. $search_option_type = Dever::input('search_option_type', 1);
  21. return array
  22. (
  23. # 表名
  24. 'name' => 'buy_order',
  25. # 显示给用户看的名称
  26. 'lang' => '采购订单',
  27. 'order' => 99,
  28. 'status' => $status,
  29. # 数据结构
  30. 'struct' => array
  31. (
  32. 'id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => 'ID',
  36. 'default' => '',
  37. 'desc' => '',
  38. 'match' => 'is_numeric',
  39. 'search' => 'order',
  40. //'list' => true,
  41. ),
  42. 'type' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '采购人类型',
  46. 'default' => '',
  47. 'desc' => '采购人类型',
  48. 'match' => 'is_numeric',
  49. ),
  50. 'type_id' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '采购人',
  54. 'default' => '',
  55. 'desc' => '采购人',
  56. 'match' => 'is_numeric',
  57. 'list' => 'Dever::load("shop/lib/manage.buyInfo", "{type}", "{type_id}")',
  58. ),
  59. 'source_type' => array
  60. (
  61. 'type' => 'int-11',
  62. 'name' => '供货商类型',
  63. 'default' => '',
  64. 'desc' => '供货商类型',
  65. 'match' => 'is_numeric',
  66. ),
  67. 'source_id' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '供货商',
  71. 'default' => '',
  72. 'desc' => '供货商',
  73. 'match' => 'is_numeric',
  74. 'list' => 'Dever::load("shop/lib/manage.buyInfo", "{source_type}", "{source_id}")',
  75. ),
  76. 'name' => array
  77. (
  78. 'type' => 'varchar-800',
  79. 'name' => '订单名称',
  80. 'default' => '',
  81. 'desc' => '订单名称',
  82. 'match' => 'is_string',
  83. 'update' => 'text',
  84. ),
  85. 'parent_order_id' => array
  86. (
  87. 'type' => 'varchar-100',
  88. 'name' => '原订单编号',
  89. 'default' => '',
  90. 'desc' => '订单编号',
  91. 'match' => 'is_string',
  92. ),
  93. 'order_num' => array
  94. (
  95. 'type' => 'varchar-100',
  96. 'name' => '订单编号',
  97. 'default' => '',
  98. 'desc' => '订单编号',
  99. 'match' => 'is_string',
  100. 'update' => 'text',
  101. 'search' => 'fulltext',
  102. 'list' => true,
  103. ),
  104. 'price' => array
  105. (
  106. 'type' => 'varchar-50',
  107. 'name' => '购买价格-销售价',
  108. 'default' => '0',
  109. 'desc' => '购买价格',
  110. 'match' => 'option',
  111. 'update' => 'text',
  112. 'list' => $search_option_type == 1 ? true : false,
  113. ),
  114. 'p_price' => array
  115. (
  116. 'type' => 'varchar-50',
  117. 'name' => '购买价格-出厂价,给厂家看的',
  118. 'default' => '0',
  119. 'desc' => '购买价格',
  120. 'match' => 'option',
  121. 'update' => 'text',
  122. 'list' => $search_option_type == 2 ? true : false,
  123. ),
  124. 'num' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '购买数量',
  128. 'default' => '',
  129. 'desc' => '购买数量',
  130. 'match' => 'is_numeric',
  131. 'search' => 'select',
  132. 'list' => true,
  133. ),
  134. 'refund_cash' => array
  135. (
  136. 'type' => 'varchar-50',
  137. 'name' => '退款合计金额-采购价格',
  138. 'default' => '0',
  139. 'desc' => '退款合计金额',
  140. 'match' => 'option',
  141. 'update' => 'text',
  142. ),
  143. 'refund_p_cash' => array
  144. (
  145. 'type' => 'varchar-50',
  146. 'name' => '退款合计金额-出厂价格',
  147. 'default' => '0',
  148. 'desc' => '退款合计金额',
  149. 'match' => 'option',
  150. 'update' => 'text',
  151. ),
  152. 'refund_status' => array
  153. (
  154. 'type' => 'tinyint-1',
  155. 'name' => '申请退款类型',
  156. 'default' => '1',
  157. 'desc' => '申请退款类型',
  158. 'match' => 'is_numeric',
  159. 'option' => $refund_status,
  160. //'search' => 'select',
  161. ),
  162. 'info' => array
  163. (
  164. 'type' => 'varchar-300',
  165. 'name' => '订单备注',
  166. 'default' => '',
  167. 'desc' => '订单备注',
  168. 'match' => 'option',
  169. 'update' => 'textarea',
  170. ),
  171. 'status' => array
  172. (
  173. 'type' => 'tinyint-1',
  174. 'name' => '状态',
  175. 'default' => '1',
  176. 'desc' => '状态',
  177. 'match' => 'is_numeric',
  178. 'option' => $status,
  179. 'search' => 'select',
  180. 'list' => 'Dever::load("mshop/lib/buy.orderStatus", "{id}")',
  181. ),
  182. 'state' => array
  183. (
  184. 'type' => 'tinyint-1',
  185. 'name' => '状态',
  186. 'default' => '1',
  187. 'desc' => '请选择状态',
  188. 'match' => 'is_numeric',
  189. ),
  190. 'operdate' => array
  191. (
  192. 'type' => 'int-11',
  193. 'name' => '审核时间',
  194. 'default' => '',
  195. 'match' => 'is_numeric',
  196. 'desc' => '',
  197. ),
  198. 'cdate' => array
  199. (
  200. 'type' => 'int-11',
  201. 'name' => '下单时间',
  202. 'match' => array('is_numeric', time()),
  203. 'desc' => '',
  204. # 只有insert时才生效
  205. 'insert' => true,
  206. 'search' => 'date',
  207. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  208. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  209. ),
  210. ),
  211. 'manage' => array
  212. (
  213. 'delete' => false,
  214. 'edit' => false,
  215. 'insert' => false,
  216. 'button' => array
  217. (
  218. //'导出订单' => array('location', 'user/lib/manage.out'),
  219. ),
  220. 'list_button' => array(
  221. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
  222. //'delete' => array('删除', '', '{status} == 1'),
  223. 'list' => array('查看详情', '"buy_order_goods&project=shop&order_id={id}&page_type=1"'),
  224. 'oper' => array('审核', '"mshop/lib/manage.audit?order_id={id}"', '{status} == 2'),
  225. //'oper1' => array('发货', '"mshop/lib/manage.send?order_id={id}"', '{status} == 3'),
  226. 'fast1' => array('发货', '"buy_order_ps&where_id={id}&search_option_order_id={id}&oper_save_jump=buy_order&oper_table=buy_order&oper_parent=buy_order"', '{status} == 3'),
  227. ),
  228. ),
  229. 'request' => array
  230. (
  231. 'getAll' => array
  232. (
  233. # 匹配的正则或函数 选填项
  234. 'option' => array
  235. (
  236. 'name' => array('yes', 'like'),
  237. 'order_num' => array('yes', 'like'),
  238. 'type' => 'yes',
  239. 'type_id' => 'yes',
  240. 'source_type' => 'yes',
  241. 'source_id' => 'yes',
  242. 'start' => array('yes-cdate', '>='),
  243. 'end' => array('yes-cdate', '<='),
  244. 'start_o' => array('yes-operdate', '>='),
  245. 'end_o' => array('yes-operdate', '<='),
  246. 'status' => array('yes', 'in'),
  247. 'refund_status' => 'yes',
  248. 'state' => 1,
  249. ),
  250. 'type' => 'all',
  251. 'order' => array('cdate' => 'desc'),
  252. 'page' => array(20, 'list'),
  253. 'col' => '*',
  254. ),
  255. # 获取订单数量
  256. 'getOrderNum' => array
  257. (
  258. # 匹配的正则或函数 选填项
  259. 'option' => array
  260. (
  261. 'start' => array('yes-cdate', '>='),
  262. 'end' => array('yes-cdate', '<='),
  263. 'start_o' => array('yes-operdate', '>='),
  264. 'end_o' => array('yes-operdate', '<='),
  265. 'type' => 'yes',
  266. 'type_id' => 'yes',
  267. 'source_type' => 'yes',
  268. 'source_id' => 'yes',
  269. 'status' => array('yes', 'in'),
  270. 'state' => 1,
  271. ),
  272. 'type' => 'count',
  273. 'col' => '*',
  274. ),
  275. # 获取总金额
  276. 'getCashNum' => array
  277. (
  278. # 匹配的正则或函数 选填项
  279. 'option' => array
  280. (
  281. 'start' => array('yes-cdate', '>='),
  282. 'end' => array('yes-cdate', '<='),
  283. 'start_o' => array('yes-operdate', '>='),
  284. 'end_o' => array('yes-operdate', '<='),
  285. 'type' => 'yes',
  286. 'type_id' => 'yes',
  287. 'source_type' => 'yes',
  288. 'source_id' => 'yes',
  289. 'status' => array('yes', 'in'),
  290. 'state' => 1,
  291. ),
  292. 'type' => 'one',
  293. 'col' => 'sum(price-refund_cash) as total',
  294. ),
  295. # 获取商品数量
  296. 'getGoodsNum' => array
  297. (
  298. # 匹配的正则或函数 选填项
  299. 'option' => array
  300. (
  301. 'start' => array('yes-cdate', '>='),
  302. 'end' => array('yes-cdate', '<='),
  303. 'start_o' => array('yes-operdate', '>='),
  304. 'end_o' => array('yes-operdate', '<='),
  305. 'type' => 'yes',
  306. 'type_id' => 'yes',
  307. 'source_type' => 'yes',
  308. 'source_id' => 'yes',
  309. 'status' => array('yes', 'in'),
  310. 'state' => 1,
  311. ),
  312. 'type' => 'one',
  313. 'col' => 'sum(num) as total',
  314. ),
  315. ),
  316. );