buy_order.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. 'fdate' => array
  191. (
  192. 'type' => 'int-11',
  193. 'name' => '完成时间',
  194. 'default' => '',
  195. 'match' => 'is_numeric',
  196. 'desc' => '',
  197. ),
  198. 'operdate' => array
  199. (
  200. 'type' => 'int-11',
  201. 'name' => '审核时间',
  202. 'default' => '',
  203. 'match' => 'is_numeric',
  204. 'desc' => '',
  205. ),
  206. 'cdate' => array
  207. (
  208. 'type' => 'int-11',
  209. 'name' => '下单时间',
  210. 'match' => array('is_numeric', time()),
  211. 'desc' => '',
  212. # 只有insert时才生效
  213. 'insert' => true,
  214. 'search' => 'date',
  215. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  216. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  217. ),
  218. ),
  219. 'manage' => array
  220. (
  221. 'delete' => false,
  222. 'edit' => false,
  223. 'insert' => false,
  224. 'button' => array
  225. (
  226. //'导出订单' => array('location', 'user/lib/manage.out'),
  227. ),
  228. 'list_button' => array(
  229. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
  230. //'delete' => array('删除', '', '{status} == 1'),
  231. 'list' => array('查看详情', '"buy_order_goods&project=shop&order_id={id}&page_type=1"'),
  232. 'oper' => array('审核', '"mshop/lib/manage.audit?order_id={id}"', '{status} == 2'),
  233. //'oper1' => array('发货', '"mshop/lib/manage.send?order_id={id}"', '{status} == 3'),
  234. //'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'),
  235. ),
  236. ),
  237. 'request' => array
  238. (
  239. 'getAll' => array
  240. (
  241. # 匹配的正则或函数 选填项
  242. 'option' => array
  243. (
  244. 'name' => array('yes', 'like'),
  245. 'order_num' => array('yes', 'like'),
  246. 'type' => 'yes',
  247. 'type_id' => 'yes',
  248. 'source_type' => 'yes',
  249. 'source_id' => 'yes',
  250. 'start' => array('yes-cdate', '>='),
  251. 'end' => array('yes-cdate', '<='),
  252. 'start_o' => array('yes-operdate', '>='),
  253. 'end_o' => array('yes-operdate', '<='),
  254. 'start_f' => array('yes-fdate', '>='),
  255. 'end_f' => array('yes-fdate', '<='),
  256. 'status' => array('yes', 'in'),
  257. 'refund_status' => 'yes',
  258. 'state' => 1,
  259. ),
  260. 'type' => 'all',
  261. 'order' => array('cdate' => 'desc'),
  262. 'page' => array(20, 'list'),
  263. 'col' => '*',
  264. ),
  265. # 获取订单数量
  266. 'getOrderNum' => array
  267. (
  268. # 匹配的正则或函数 选填项
  269. 'option' => array
  270. (
  271. 'start' => array('yes-cdate', '>='),
  272. 'end' => array('yes-cdate', '<='),
  273. 'start_o' => array('yes-operdate', '>='),
  274. 'end_o' => array('yes-operdate', '<='),
  275. 'type' => 'yes',
  276. 'type_id' => 'yes',
  277. 'source_type' => 'yes',
  278. 'source_id' => 'yes',
  279. 'status' => array('yes', 'in'),
  280. 'state' => 1,
  281. ),
  282. 'type' => 'count',
  283. 'col' => '*',
  284. ),
  285. # 获取总金额
  286. 'getCashNum' => array
  287. (
  288. # 匹配的正则或函数 选填项
  289. 'option' => array
  290. (
  291. 'start' => array('yes-cdate', '>='),
  292. 'end' => array('yes-cdate', '<='),
  293. 'start_o' => array('yes-operdate', '>='),
  294. 'end_o' => array('yes-operdate', '<='),
  295. 'type' => 'yes',
  296. 'type_id' => 'yes',
  297. 'source_type' => 'yes',
  298. 'source_id' => 'yes',
  299. 'status' => array('yes', 'in'),
  300. 'state' => 1,
  301. ),
  302. 'type' => 'one',
  303. 'col' => 'sum(price-refund_cash) as total',
  304. ),
  305. # 获取总金额
  306. 'getPCashNum' => array
  307. (
  308. # 匹配的正则或函数 选填项
  309. 'option' => array
  310. (
  311. 'start' => array('yes-cdate', '>='),
  312. 'end' => array('yes-cdate', '<='),
  313. 'start_o' => array('yes-operdate', '>='),
  314. 'end_o' => array('yes-operdate', '<='),
  315. 'type' => 'yes',
  316. 'type_id' => 'yes',
  317. 'source_type' => 'yes',
  318. 'source_id' => 'yes',
  319. 'status' => array('yes', 'in'),
  320. 'state' => 1,
  321. ),
  322. 'type' => 'one',
  323. 'col' => 'sum(p_price-refund_p_cash) as total',
  324. ),
  325. # 获取商品数量
  326. 'getGoodsNum' => array
  327. (
  328. # 匹配的正则或函数 选填项
  329. 'option' => array
  330. (
  331. 'start' => array('yes-cdate', '>='),
  332. 'end' => array('yes-cdate', '<='),
  333. 'start_o' => array('yes-operdate', '>='),
  334. 'end_o' => array('yes-operdate', '<='),
  335. 'type' => 'yes',
  336. 'type_id' => 'yes',
  337. 'source_type' => 'yes',
  338. 'source_id' => 'yes',
  339. 'status' => array('yes', 'in'),
  340. 'state' => 1,
  341. ),
  342. 'type' => 'one',
  343. 'col' => 'sum(num) as total',
  344. ),
  345. ),
  346. );