update.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. session_start();
  3. if (isset($_SESSION["username"])) {
  4. ?>
  5. <?php require_once('common/header.php'); ?>
  6. <!--页面主要内容-->
  7. <main class="lyear-layout-content">
  8. <div class="container-fluid">
  9. <?php
  10. include_once("../untils/conn.php");
  11. $id = $_GET['id'];
  12. $data = mysqli_query($con, "select * from list where id=" . $id);
  13. $rows = mysqli_fetch_row($data);
  14. ?>
  15. <div class="card">
  16. <div class="card-header bg-primary">
  17. <h4>更新产品</h4>
  18. </div>
  19. <div class="card-body">
  20. <form class="form-horizontal" action="controller/doUpdate.php" method="POST">
  21. <div class="form-group">
  22. <label for="title" class="col-xs-12">名称:</label>
  23. <div class="col-xs-12">
  24. <input type="text" class="form-control" name="name" placeholder="请输入产品名称" value="<?php echo $rows[2] ?>" required>
  25. </div>
  26. </div>
  27. <div class="form-group">
  28. <label class="col-xs-12">提单接口:</label>
  29. <div class="col-xs-12">
  30. <select class="form-control" id="provider" onchange="toggleInput()" name="api_type">
  31. <?php
  32. $apiType = $rows[21]; // 从数据库中获取api_type的值
  33. $options = array(
  34. "yqrapi" => "172系统",
  35. "yidong" => "移动",
  36. "hnhklt" => "海南联通",
  37. "zgdx" => "电信",
  38. "gantanhao" => "感探号",
  39. "haokeyun" => "号氪云"
  40. );
  41. foreach ($options as $value => $label) {
  42. $selected = ($apiType == $value) ? "selected" : "";
  43. echo "<option value=\"$value\" $selected>$label</option>";
  44. }
  45. ?>
  46. </select>
  47. </div>
  48. </div>
  49. <div class="form-group" id="haokaidGroup" style="display: none;" >
  50. <label for="title" class="col-xs-12">172商品id:</label>
  51. <div class="col-xs-12">
  52. <input type="text" class="form-control" name="yqrid" placeholder="没有请填写0" value="<?php echo $rows[1] ?>" >
  53. </div>
  54. </div>
  55. <div class="form-group" id="ltGroup" style="display: none;" >
  56. <label class="col-xs-12">联通产品类型:</label>
  57. <div class="col-xs-12">
  58. <input type="text" class="form-control" name="productType" placeholder="联通产品类型ID" value="<?php echo $rows[1] ?>" >
  59. </div>
  60. </div>
  61. <div class="form-group" id="haoke" style="display: none;" >
  62. <label class="col-xs-12">号氪云产品编码:</label>
  63. <div class="col-xs-12">
  64. <input type="text" class="form-control" name="goodsCode" placeholder="号氪云产品编码" value="<?php echo $rows[1] ?>" >
  65. </div>
  66. </div>
  67. <div class="form-group" id="gantan" style="display: none;" >
  68. <label class="col-xs-12">感叹号产品编号:</label>
  69. <div class="col-xs-12">
  70. <input type="text" class="form-control" name="sku" placeholder="感叹号产品编号" value="<?php echo $rows[1] ?>">
  71. </div>
  72. </div>
  73. <div class="form-group" id="xhGroup" style="display: none;">
  74. <label class="col-xs-12">是否支持选号:</label>
  75. <div class="col-xs-12">
  76. <select class="form-control" name="se_num">
  77. <?php
  78. $seNum = $rows[22]; // 从数据库中获取se_num的值
  79. $options = array(
  80. "0" => "不支持",
  81. "1" => "支持"
  82. );
  83. foreach ($options as $value => $label) {
  84. $selected = ($seNum == $value) ? "selected" : "";
  85. echo "<option value=\"$value\" $selected>$label</option>";
  86. }
  87. ?>
  88. </select>
  89. </div>
  90. </div>
  91. <div class="form-group">
  92. <label class="col-xs-12">下单模版:</label>
  93. <div class="col-xs-12">
  94. <select class="form-control" name = "downtel">
  95. <?php
  96. $downtel = $rows[23]; // 从数据库中获取downtel的值
  97. $options = array(
  98. "one" => "默认模板-系统平台模版",
  99. "two" => "蓝色互动模版-不支持选号"
  100. );
  101. foreach ($options as $value => $label) {
  102. $selected = ($downtel == $value) ? "selected" : "";
  103. echo "<option value=\"$value\" $selected>$label</option>";
  104. }
  105. ?>
  106. </select>
  107. </div>
  108. </div>
  109. <div class="form-group">
  110. <label for="title" class="col-xs-12">介绍:</label>
  111. <div class="col-xs-12">
  112. <input type="text" class="form-control" name="jieshao" placeholder="请输入产品简短介绍" value="<?php echo $rows[3] ?>" required>
  113. </div>
  114. </div>
  115. <div class="form-group">
  116. <label for="title" class="col-xs-12">时长:</label>
  117. <div class="col-xs-12">
  118. <input type="text" class="form-control" name="ltime" placeholder="套餐时长,建议四个字" value="<?php echo $rows[5] ?>" required>
  119. </div>
  120. </div>
  121. <div class="form-group">
  122. <label class="col-xs-12">运营商:</label>
  123. <div class="col-xs-12">
  124. <?php
  125. include_once("../untils/conn.php");
  126. mysqli_query($con, "set names utf8");
  127. if ($con) {
  128. //选择数据库
  129. if ($db) {
  130. //获取数据总行数
  131. $sortsql = "select * from sort";
  132. $sortdata = mysqli_query($con, $sortsql);
  133. ?>
  134. <select name="yys" id="yys" class="form-control">
  135. <?php
  136. while ($sortrow = mysqli_fetch_array($sortdata)) {
  137. ?>
  138. <option value="<?php echo $sortrow["yys"] ?>" name="yys" <?php echo $rows[5] == $sortrow["yys"] ? 'selected' : '' ?>><?php echo $sortrow["yys"] ?></option>
  139. <?php
  140. }
  141. ?>
  142. </select>
  143. <?php
  144. }
  145. }
  146. ?>
  147. </div>
  148. </div>
  149. <div class="form-group">
  150. <label class="col-xs-12">限龄:</label>
  151. <div class="col-xs-12">
  152. <input type="text" class="form-control" name="other" placeholder="可以写限龄,或其他,用于显示前台,可为空" value="<?php echo $rows[11] ?>" >
  153. </div>
  154. </div>
  155. <div class="form-group">
  156. <label for="title" class="col-xs-12">归属地:</label>
  157. <div class="col-xs-12">
  158. <input type="text" class="form-control" name="gsd" placeholder="请输入号卡归属地" value="<?php echo $rows[9] ?>" required>
  159. </div>
  160. </div>
  161. <div class="form-group">
  162. <label for="title" class="col-xs-12">商品标签:</label>
  163. <div class="col-xs-12">
  164. <input type="text" class="form-control" name="xuanhao" placeholder="请输入选号方式(激活选号/选号下单/随机号码)" value="<?php echo $rows[10] ?>" required>
  165. </div>
  166. </div>
  167. <div class="form-group">
  168. <label for="title" class="col-xs-12">快递方式:</label>
  169. <div class="col-xs-12">
  170. <input type="text" class="form-control" name="baoyou" placeholder="可输入全国免费包邮/京东物流等" value="<?php echo $rows[12] ?>" required>
  171. </div>
  172. </div>
  173. <div class="form-group">
  174. <label for="title" class="col-xs-12">主图链接:</label>
  175. <div class="col-xs-12">
  176. <input type="url" class="form-control" name="zhutu" placeholder="主图URL地址" value="<?php echo $rows[4] ?>" required>
  177. </div>
  178. </div>
  179. <div class="form-group">
  180. <label for="title" class="col-xs-12">详情图链接:</label>
  181. <div class="col-xs-12">
  182. <input type="url" class="form-control" name="link" value="<?php echo $rows[8] ?>" placeholder="请输入详情图链接" required>
  183. </div>
  184. </div>
  185. <div class="form-group">
  186. <label class="col-xs-12">商品真实佣金(填写真实佣金用于数据计算)</label>
  187. <div class="col-xs-12">
  188. <input type="text" class="form-control" name="price" value="<?php echo $rows[17] ?>" placeholder="商品佣金" required>
  189. </div>
  190. </div>
  191. <div class="form-group">
  192. <label class="col-xs-12">代理佣金(用于结算代理的佣金,请用商品说明一致)</label>
  193. <div class="col-xs-12">
  194. <input type="text" class="form-control" name="proxy_price" value="<?php echo $rows[19] ?>" placeholder="商品佣金" required>
  195. </div>
  196. </div>
  197. <div class="form-group">
  198. <label class="col-xs-12" for="notes">商品说明(代理看到的佣金说明)</label>
  199. <div class="col-xs-12">
  200. <textarea class="form-control" name="notes" placeholder="商品代理说明"><?php echo $rows[18] ?></textarea>
  201. </div>
  202. </div>
  203. <div class="form-group">
  204. <input type="hidden" name="id" value="<?php echo $id ?>">
  205. <div class="offset-2 col-xs-12">
  206. <button class="btn btn-success" type="submit" value="添加">确认修改</button>
  207. </div>
  208. </div>
  209. </form>
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. </main>
  219. <script>
  220. window.onload = function() {
  221. toggleInput();
  222. };
  223. function toggleInput() {
  224. var provider = document.getElementById("provider").value;
  225. var haokaidGroup = document.getElementById("haokaidGroup");
  226. var ltGroup = document.getElementById("ltGroup");
  227. var xhGroup = document.getElementById("xhGroup");
  228. var haoke = document.getElementById("haoke");
  229. var gantan = document.getElementById("gantan");
  230. if (provider === "yqrapi") {
  231. haokaidGroup.style.display = "block";
  232. ltGroup.style.display = "none";
  233. xhGroup.style.display = "none";
  234. haoke.style.display = "none";
  235. gantan.style.display = "none";
  236. } else if (provider === "hnhklt") {
  237. haokaidGroup.style.display = "none";
  238. ltGroup.style.display = "block";
  239. xhGroup.style.display = "block";
  240. haoke.style.display = "none";
  241. gantan.style.display = "none";
  242. } else if (provider === "haokeyun") {
  243. haokaidGroup.style.display = "none";
  244. ltGroup.style.display = "none";
  245. xhGroup.style.display = "none";
  246. haoke.style.display = "block";
  247. gantan.style.display = "none";
  248. } else if (provider === "gantanhao") {
  249. haokaidGroup.style.display = "none";
  250. ltGroup.style.display = "none";
  251. xhGroup.style.display = "none";
  252. haoke.style.display = "none";
  253. gantan.style.display = "block";
  254. } else {
  255. haokaidGroup.style.display = "none";
  256. ltGroup.style.display = "none";
  257. xhGroup.style.display = "none";
  258. haoke.style.display = "none";
  259. gantan.style.display = "none";
  260. }
  261. }
  262. </script>
  263. <!--End 页面主要内容-->
  264. <?php require_once('common/footer.php'); ?>
  265. <?php
  266. } else {
  267. echo "<script>alert('您尚未登录,没有权限访问该页面');location.href='login.php';</script>";
  268. }