GoodsDetailScreen.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. // import * as WebBrowser from "expo-web-browser";
  2. // import * as React from "react";
  3. // import {
  4. // Image,
  5. // Platform,
  6. // StyleSheet,
  7. // View,
  8. // ImageBackground,
  9. // } from "react-native";
  10. // import {
  11. // Layout,
  12. // Tab,
  13. // TabView,
  14. // Text,
  15. // useTheme,
  16. // Button,
  17. // Card,
  18. // List,
  19. // Input,
  20. // Icon,
  21. // } from "@ui-kitten/components";
  22. // import { useModel } from "flooks";
  23. // import { useFocusEffect } from "@react-navigation/native";
  24. // import ActionButton from "react-native-action-button";
  25. // import ScrollPage from "../../components/ScrollPage";
  26. // import EmptyComponent from "../../components/EmptyComponent";
  27. // import NavHeaderBar from "../../components/NavHeaderBar";
  28. // export default function GoodsDetailScreen() {
  29. // const theme = useTheme();
  30. // const { changeBackground } = useModel("barModel", true);
  31. // const { mid } = useModel("userModel");
  32. // const { httpGet, httpPost } = useModel("httpModel", true);
  33. // const { success, warnning } = useModel("loadingModel", true);
  34. // const { showDialog } = useModel("dialogModel");
  35. // const {
  36. // userTitle21,
  37. // fullReduction2,
  38. // fullReduction1,
  39. // delText,
  40. // editText,
  41. // confirm,
  42. // cancel,
  43. // complete,
  44. // successText,
  45. // removeTips,
  46. // } = useModel("wordsModel");
  47. // const [fullReductions, changeFllReduction] = React.useState([
  48. // { fullAmount: "", minusAmount: "" },
  49. // ]);
  50. // useFocusEffect(
  51. // React.useCallback(() => {
  52. // changeBackground(theme["color-primary-500"]);
  53. // httpGet("/fullReduction/my").then((res) => {
  54. // if (res.length > 0) {
  55. // changeFllReduction(
  56. // res.map((item) => {
  57. // return { ...item, edit: false };
  58. // })
  59. // );
  60. // }
  61. // });
  62. // }, [])
  63. // );
  64. // const renderItem = ({ item, index }) => {
  65. // if (!item.id || item.edit) {
  66. // return editItem(item, index);
  67. // } else {
  68. // return saveItem(item);
  69. // }
  70. // };
  71. // const saveItem = (info, index) => (
  72. // <Layout style={styles.item}>
  73. // <Text style={styles.text}>
  74. // {fullReduction1}
  75. // {info.fullAmount}
  76. // {fullReduction2}
  77. // {info.minusAmount}
  78. // </Text>
  79. // <Button
  80. // size='small'
  81. // appearance='outline'
  82. // onPress={() => editInfo(info, index)}
  83. // >
  84. // {editText}
  85. // </Button>
  86. // <Button
  87. // size='small'
  88. // status='danger'
  89. // style={styles.buttonlast}
  90. // onPress={() => delInfo(info, index)}
  91. // >
  92. // {delText}
  93. // </Button>
  94. // </Layout>
  95. // );
  96. // const editItem = (info, index) => (
  97. // <Layout style={styles.item}>
  98. // <Layout style={[styles.text, styles.flexRow]}>
  99. // <Text>{fullReduction1}</Text>
  100. // <Input
  101. // size='small'
  102. // value={info.fullAmount}
  103. // style={styles.input}
  104. // key={0}
  105. // keyboardType='numeric'
  106. // onChangeText={(value) => changeText(value, index, "full")}
  107. // />
  108. // <Text>{fullReduction2}</Text>
  109. // <Input
  110. // size='small'
  111. // value={info.minusAmount}
  112. // style={styles.input}
  113. // key={1}
  114. // keyboardType='numeric'
  115. // onChangeText={(value) => changeText(value, index, "minus")}
  116. // />
  117. // </Layout>
  118. // <Button size='small' onPress={() => saveInfo(info, index)}>
  119. // {confirm}
  120. // </Button>
  121. // <Button
  122. // size='small'
  123. // appearance='outline'
  124. // style={styles.buttonlast}
  125. // onPress={() => cancelInfo(info, index)}
  126. // >
  127. // {cancel}
  128. // </Button>
  129. // </Layout>
  130. // );
  131. // const editInfo = (info, index) => {
  132. // let _fullReductions = [...fullReductions];
  133. // info.edit = true;
  134. // _fullReductions[index] = info;
  135. // changeFllReduction(_fullReductions);
  136. // };
  137. // const delInfo = (info, index) => {
  138. // showDialog({
  139. // bodyText: removeTips,
  140. // status: "danger",
  141. // cancelable: true,
  142. // confirmCallback: () => {
  143. // httpPost("/fullReduction/del/" + info.id)
  144. // .then((res) => {
  145. // success(successText);
  146. // let _fullReductions = [...fullReductions];
  147. // _fullReductions.splice(index, 1);
  148. // changeFllReduction(_fullReductions);
  149. // })
  150. // .catch((e) => {
  151. // warnning(e.error);
  152. // });
  153. // },
  154. // });
  155. // };
  156. // const cancelInfo = (info, index) => {
  157. // let _fullReductions = [...fullReductions];
  158. // if (info.id) {
  159. // info.edit = false;
  160. // _fullReductions[index] = info;
  161. // } else {
  162. // _fullReductions.pop();
  163. // }
  164. // changeFllReduction(_fullReductions);
  165. // };
  166. // const saveInfo = (info, index) => {
  167. // httpPost(
  168. // "/fullReduction/save",
  169. // {
  170. // ...info,
  171. // merchantId: mid,
  172. // },
  173. // {
  174. // body: "json",
  175. // }
  176. // )
  177. // .then((res) => {
  178. // success(successText);
  179. // let _fullReductions = [...fullReductions];
  180. // _fullReductions.splice(index, 1, {
  181. // ...res,
  182. // edit: false,
  183. // });
  184. // changeFllReduction(_fullReductions);
  185. // })
  186. // .catch((e) => {
  187. // warnning(e.error);
  188. // });
  189. // };
  190. // function changeText(value, index, type) {
  191. // let _fullReductions = [...fullReductions];
  192. // let info = _fullReductions[index];
  193. // if (type == "full") {
  194. // info.fullAmount = value;
  195. // } else {
  196. // info.minusAmount = value;
  197. // }
  198. // _fullReductions.splice(index, 1, info);
  199. // changeFllReduction(_fullReductions);
  200. // }
  201. // const addFullReduction = () => {
  202. // console.log("aaa");
  203. // let _fullReductions = [...fullReductions];
  204. // let last = _fullReductions[_fullReductions.length - 1];
  205. // if (last.id) {
  206. // _fullReductions.push({
  207. // fullAmount: "",
  208. // minusAmount: "",
  209. // });
  210. // changeFllReduction(_fullReductions);
  211. // }
  212. // };
  213. // return (
  214. // <>
  215. // <NavHeaderBar title={userTitle21} />
  216. // <ScrollPage style={styles.lay}>
  217. // <Layout style={[styles.lay]}>
  218. // <List
  219. // style={styles.list}
  220. // data={fullReductions}
  221. // renderItem={renderItem}
  222. // ListEmptyComponent={EmptyComponent}
  223. // />
  224. // </Layout>
  225. // <ActionButton
  226. // buttonColor={theme["color-primary-500"]}
  227. // onPress={addFullReduction}
  228. // position='left'
  229. // />
  230. // </ScrollPage>
  231. // </>
  232. // );
  233. // }
  234. // const PulsIcon = (props) => (
  235. // <Icon
  236. // {...props}
  237. // style={[props.style, { width: 33, height: 33 }]}
  238. // name='plus-circle'
  239. // />
  240. // );
  241. // const styles = StyleSheet.create({
  242. // lay: {
  243. // backgroundColor: "#fff",
  244. // },
  245. // padBot: {
  246. // paddingBottom: 100,
  247. // },
  248. // list: {
  249. // paddingVertical: 10,
  250. // paddingHorizontal: 15,
  251. // backgroundColor: "transparent",
  252. // flex: 0,
  253. // },
  254. // item: {
  255. // flexDirection: "row",
  256. // alignItems: "center",
  257. // paddingVertical: 10,
  258. // },
  259. // input: {
  260. // marginHorizontal: 5,
  261. // minWidth: 49,
  262. // },
  263. // text: {
  264. // flex: 1,
  265. // },
  266. // flexRow: {
  267. // flexDirection: "row",
  268. // alignItems: "center",
  269. // },
  270. // buttonlast: {
  271. // marginLeft: 10,
  272. // },
  273. // button: {
  274. // alignSelf: "flex-start",
  275. // },
  276. // });