mall-deal-detail-finished.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>详情-订单-创业帮</title>
  6. <meta name="keywords" content="详情-订单-创业帮">
  7. <meta name="description" content="详情-订单-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="详情-订单-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgc-back pt0" style="padding-top:0;">
  18. <div id="app" v-cloak>
  19. <van-nav-bar class="user_rank_explan_title user_title_normal f16 rightbtn" title="订单详情" @click-left="goback" left-arrow v-if="toptitleisshow" v-cloak>
  20. <template #left> <img src="./static/images/icon-comback@2x.png" alt=""></template>
  21. </van-nav-bar>
  22. <div class="deal-detail" v-cloak>
  23. <van-cell class="deal-status" title="等待付款" center :border="false" v-if="orderinfo.Status === 0"></van-cell>
  24. <van-cell class="deal-status" title="付款成功" center :border="false" v-if="orderinfo.Status === 1"></van-cell>
  25. <van-cell class="deal-status" title="交易完成" center :border="false" v-if="orderinfo.Status === 2"></van-cell>
  26. <van-cell class="deal-address bb8f7f7f7" :label="orderinfo.Areas + orderinfo.Address" icon="location" center :border="false" v-if="orderinfo.DeliveryType === 1 &amp;&amp; !isnews">
  27. <template #title><span class="mr12">{{orderinfo.RealName}}</span><span>{{orderinfo.Mobile}}</span></template>
  28. </van-cell>
  29. <van-cell class="deal-address bb8f7f7f7" icon="location" center :border="false" v-if="orderinfo.DeliveryType === 2 &amp;&amp; !isnews">
  30. <template #title><span class="mr12">上门自提</span></template>
  31. </van-cell>
  32. <van-cell-group :border="false">
  33. <van-card class="suremall" v-for="item,index in orderinfo.Products" :price="item.ProductPrice | tofixed2" :title="item.ProductName" :num="item.ProductCount" :thumb="item.ProductPhoto" :key="index" :lazy-load="true" centered>
  34. <template #footer v-if="index === orderinfo.Products.length - 1">
  35. <div class="tr van-hairline--top pt8 mt8"><span class="f12 c666">共{{orderinfo.BuyCount}}件商品 实付金额:</span><span class="f14 c333">¥{{orderinfo.TotalPrice | tofixed2}}</span></div>
  36. </template>
  37. </van-card>
  38. </van-cell-group>
  39. <van-cell-group class="bb8f7f7f7 bt8f7f7f7" :border="false">
  40. <van-cell title="发货状态" :value="orderinfo.PayDate !== '' ? '已发货':'未发货'" :border="false"></van-cell>
  41. <van-cell title="订单编号" :border="false">
  42. <template #right-icon>
  43. <div class="f12 dib c999 pr16" id="dealId">{{orderinfo.OrderNo}}</div><span class="c666 f10" style="border:1px solid #eee; border-radius:2px; padding:0 2px" :data-clipboard-text="orderinfo.OrderNo" data-clipboard-action="copy" data-clipboard-target="#dealId" ref="copy" id="copy" @click="copyCode" @mouseenter="copyCode">复制</span>
  44. </template>
  45. </van-cell>
  46. <van-cell title="下单时间" :value="orderinfo.CreateDate" :border="false"></van-cell>
  47. <van-cell title="付款时间" :value="orderinfo.PayDate" :border="false" v-if="orderinfo.PayDate !== ''"></van-cell>
  48. <van-cell class="spcell" title="兑换券码" :value="orderinfo.PayDate" :border="false" v-if="orderinfo.PayDate !== '' &amp;&amp; isnews">
  49. <template #default>
  50. <div v-for="item,index in codearr" @click="checkitem(index)">
  51. <div class="f14 c333">{{item[0]}} - {{item[item.length -1]}}
  52. <van-icon name="arrow-down" v-if="checkindex !== index"></van-icon>
  53. <van-icon name="arrow-up" v-if="checkindex === index"></van-icon>
  54. </div>
  55. <div class="f14 c333" v-for="item in codearr[checkindex]" v-if="checkindex === index">{{item}}</div>
  56. </div>
  57. </template>
  58. </van-cell>
  59. </van-cell-group>
  60. <van-cell-group :border="false" v-if="!isnews">
  61. <van-cell title="发货仓库" :border="false">
  62. <template #right-icon>
  63. <div class="f12 dib c999 mr12">{{orderinfo.StoreContact}}</div>
  64. <div class="f12 dib c999 mr12">{{orderinfo.StoreContactMobile}}</div>
  65. <van-button class="c999" plain size="mini" @click="takephone(orderinfo.StoreContactMobile)">拨号</van-button>
  66. </template>
  67. </van-cell>
  68. <van-cell title="提货方式" :value="orderinfo.DeliveryType === 1 ? '邮寄到付':'上门自提'" :border="false"></van-cell>
  69. <van-cell title="提货仓库" :value="orderinfo.StoreName" :border="false"></van-cell>
  70. </van-cell-group>
  71. </div>
  72. <van-goods-action class="mall-bottom" v-if="orderinfo.Status === 0">
  73. <van-goods-action-button class="kxs-btn" type="default" color="#FFD500" style="color:#333;" text="继续完成支付" @click="onClickButton"></van-goods-action-button>
  74. </van-goods-action>
  75. <van-popup class="payTypePop bgc-back" v-model="payTypePop" position="bottom" closeable close-icon-position="top-left" :style="{ height: '50%' }">
  76. <div class="tc pt16 rel">
  77. <div class="f18 c333">确认付款</div>
  78. </div>
  79. <div class="pt32 pb32 tc">
  80. <div class="f24 c333"><span class="f16">¥</span>{{orderinfo.TotalPrice | tofixed2}}</div>
  81. </div>
  82. <van-radio-group v-model="radio">
  83. <van-cell-group :border="false">
  84. <van-cell title="支付宝" clickable @click="radio = 1" icon="alipay">
  85. <template #right-icon>
  86. <van-radio :name="1"></van-radio>
  87. </template>
  88. </van-cell>
  89. <van-cell title="余额" clickable @click="radio = 3" icon="gold-coin">
  90. <template #title>
  91. <div>余额 <span class="ml16 c999">可用余额: ( ¥{{balance}} )</span></div>
  92. </template>
  93. <template #right-icon>
  94. <van-radio :name="3"></van-radio>
  95. </template>
  96. </van-cell>
  97. </van-cell-group>
  98. </van-radio-group>
  99. <van-goods-action class="mall-bottom">
  100. <van-goods-action-button type="danger" text="确认支付" @click="gotoInputPwd"></van-goods-action-button>
  101. </van-goods-action>
  102. </van-popup>
  103. <van-popup class="pwdPop" v-model="pwdPop" position="bottom" @close="onKeyboardHide" closeable close-icon-position="top-left" :style="{ height: '60%' }">
  104. <div class="tc pt16 rel">
  105. <div class="f18 c333">输入密码</div>
  106. <div class="pop-forgetpwd abs f14 c666"></div>
  107. </div>
  108. <div class="pt8">
  109. <van-password-input class="mt8" :value="value" :info="pwdInfo" :error-info="errorInfo" :focused="showKeyboard" @focus="showKeyboard = true"></van-password-input>
  110. </div>
  111. <van-number-keyboard v-model="value" :show="true" maxlength="6"></van-number-keyboard>
  112. </van-popup>
  113. </div>
  114. <script src="./static/js/clipboard.min.js"></script>
  115. <script src="./static/js/klm-vv.min.js"></script>
  116. <script src="./static/js/appfunc.min.js"></script>
  117. <script src="./static/js/klm-axios-config.js"></script>
  118. <script src="./static/js/publicfn.js"></script>
  119. <script>
  120. //- function OnStart(){
  121. //- app.getorderinfo();
  122. //- PublicLib.ShowMsg({Title:'标题', Message:'OnStart'});
  123. //- };
  124. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  125. // 可以通过下面的方式手动注册
  126. Vue.use(vant.Lazyload);
  127. // 在 #app 标签下渲染一个按钮组件
  128. let app = new Vue({
  129. el: '#app',
  130. data() {
  131. return {
  132. //- 兑换码列表
  133. codearr:[[]],
  134. checkindex:-1,
  135. isnews:false,
  136. toptitleisshow:false,
  137. payTypePop: false,
  138. pwdPop: false,
  139. chosenAddressId: 1,
  140. orderinfo:{
  141. Status: '', //状态
  142. OrderNo: "", //订单号
  143. RealName: "", //姓名
  144. Mobile: "", //手机号
  145. TotalPrice: 0, //总价
  146. Areas: "", //所在地区
  147. Address: "", //详细地址
  148. BuyCount: 0, //下单数量
  149. SendStatus: 0, //1已发货0未发货发货状态
  150. CreateDate: "", //创建时间
  151. PayDate: "", //付款时间
  152. DeliveryType: 1, //提货类型1邮寄到付2自提
  153. StoreContact: "", //仓库联系人
  154. StoreContactMobile: "", //仓库联系人电话
  155. StoreName: "", //提货仓库
  156. Products:[
  157. {
  158. ProductName:'商品名称',
  159. ProductPrice:'0.00',
  160. ProductCount:'0',
  161. ProductPhoto:'',
  162. }
  163. ]
  164. },
  165. balance:0,
  166. value: '',
  167. errorInfo: '',
  168. showKeyboard: true,
  169. radio: 1,
  170. pwdInfo: '密码为 6 位数字',
  171. flag:true,
  172. };
  173. },
  174. watch: {
  175. async value(value) {
  176. if(value.length === 6){
  177. //- 验证原支付密码
  178. const Id = PublicLib.getCookieInfo('userId');
  179. const res = await getRequest('api/v1/users/checkpaypwd?t='+Math.random(6),JSON.stringify({Id,PayPwd:this.value}));
  180. if(res.status === '1'){
  181. this.pwdInfo = '密码正确';
  182. const that = this;
  183. this.payfn();
  184. this.getorderinfo();
  185. setTimeout(function(){
  186. that.value = '';
  187. },800);
  188. }else{
  189. this.errorInfo = '密码错误';
  190. const that = this;
  191. setTimeout(function(){
  192. that.value = '';
  193. },2000);
  194. };
  195. } else if(value.length === 0){
  196. this.errorInfo = '';
  197. this.pwdInfo = '密码为 6 位数字';
  198. } else{
  199. this.errorInfo = '';
  200. this.pwdInfo = '再输入' + (6 - value.length) + '位密码';
  201. }
  202. },
  203. },
  204. created(){
  205. this.toptitleisshow = toptitleisshow;
  206. this.getorderinfo();
  207. },
  208. beforeUpdate(){
  209. this.$nextTick(() => {
  210. console.log(this.$refs.copy)
  211. },10);
  212. },
  213. methods: {
  214. checkitem(index){
  215. if(index !== this.checkindex){
  216. this.checkindex = index;
  217. }else{this.checkindex = -1};
  218. },
  219. async getorderinfo(){
  220. const UserId = PublicLib.getCookieInfo('userId');
  221. const Id = PublicLib.getCookieInfo('mallorderId');
  222. const res = await getRequest('api/v1/orders/detail2?t='+Math.random(6),JSON.stringify({UserId,Id}));
  223. if(res.status !== '1') return tips('获取订单详情失败,请重试!');
  224. let ind = 0;
  225. res.data.ExchangeCodeList.forEach((item,index)=>{
  226. this.codearr[ind].push(item);
  227. if(index % 100 === 0 && index !== 0){
  228. this.codearr.push([]);
  229. ind++;
  230. };
  231. });
  232. this.orderinfo = res.data;
  233. if(res.data.DeliveryType === 0){
  234. this.isnews = true;
  235. }else{
  236. this.isnews = false;
  237. };
  238. },
  239. //余额查询
  240. async getNoun(){
  241. const UserId = PublicLib.getCookieInfo('userId');
  242. const res = await getRequest('api/v1/useraccount/myaccount?t='+Math.random(6),JSON.stringify({UserId}));
  243. this.balance = tofixed2(res.data.BalanceAmount);
  244. },
  245. giveToast(str){
  246. vant.Toast(str);
  247. },
  248. copyCode(){
  249. clipboard = new ClipboardJS(this.$refs.copy);
  250. const that = this;
  251. this.$nextTick(() => {
  252. clipboard.on('success', function(e) {
  253. that.giveToast('复制成功');
  254. });
  255. clipboard.on('error', function(e) {
  256. that.giveToast('复制失败,请手动选择复制!');
  257. });
  258. });
  259. },
  260. onClickButton() {
  261. this.payTypePop = true;
  262. this.getNoun()
  263. },
  264. async payfn(){
  265. const Id = PublicLib.getCookieInfo('mallorderId');
  266. const UserId = PublicLib.getCookieInfo('userId');
  267. const res = await postRequest('api/v1/orders/pay?t='+Math.random(6),JSON.stringify({UserId,PayMode:this.radio,Id}));
  268. if(res.status !== '1')return tips(res.info)
  269. //- if(this.radio === 2) {
  270. //- PublicLib.RequestWechatPay({
  271. //- OrderInfo: res.data.PayData,
  272. //- SuccessUrl:'mall-deal-detail-finished',
  273. //- FailUrl:'mall-deal-detail-finished'
  274. //- });
  275. //- this.flag = false;
  276. //- }else
  277. if(this.radio === 1) {
  278. PublicLib.RequestAlipay({
  279. OrderInfo: res.data.PayData,
  280. SuccessUrl:'mall-deal-detail-finished',
  281. FailUrl:'mall-deal-detail-finished'
  282. });
  283. this.flag = false;
  284. } else {
  285. tips('支付成功!');
  286. setTimeout(()=>{
  287. this.pwdPop = false;
  288. this.getorderinfo();
  289. },2000)
  290. };
  291. },
  292. //- 点击确认支付
  293. async gotoInputPwd() {
  294. if(Number(this.orderinfo.TotalPrice)>Number(this.balance) && this.radio === 3) return tips('余额不足,请更换付款方式');
  295. this.paydata = '';
  296. this.payTypePop = false;
  297. switch(this.radio){
  298. case 3:
  299. const Id = PublicLib.getCookieInfo('userId');
  300. const res = await getRequest('api/v1/users/existpaypwd?t='+Math.random(6),JSON.stringify({Id}));
  301. if(res.status !== '1') return PublicLib.Goto({Url:'user-setpaypwd-1'});
  302. this.pwdPop = true;
  303. break;
  304. case 1:
  305. this.payfn();
  306. break;
  307. case 2:
  308. //- this.payfn();
  309. break;
  310. };
  311. },
  312. onKeyboardHide(){
  313. this.value = '';
  314. this.radio = 3;
  315. },
  316. //- 拨打电话
  317. takephone(phonenum){
  318. PublicLib.PhoneCall(phonenum);
  319. },
  320. goback(){
  321. if(this.flag){
  322. PublicLib.GoBack({Level:1});
  323. }else{
  324. PublicLib.GoBack({Level:2});
  325. }
  326. }
  327. }
  328. });
  329. </script>
  330. </body>
  331. </html>