servicePay.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="carbox">
  5. <view class="addressBox">
  6. <view class="goHome">
  7. <view class="u-p30">
  8. <view class=" u-font28 u-999 u-flex-center-sb" style="border-bottom: 1rpx solid #E6E6E6;padding-bottom: 30rpx;margin-bottom: 30rpx;" >
  9. <text class="u-333 u-bold ">姓名:</text>
  10. <view class="u-flex-center-sb u-text-left">
  11. <input
  12. type="text"
  13. :value="name"
  14. @input="userName"
  15. maxlength="8"
  16. placeholder="请输入"
  17. style="margin-right: 14rpx;text-align: right;"
  18. />
  19. <picker
  20. class="choice"
  21. @change="bindPickerChange"
  22. :value="gender"
  23. :range="platform"
  24. range-key="name"
  25. >
  26. <view class="uni-input sex"
  27. >{{ platform[index].name
  28. }}<text class="iconfont">&#xe645;</text></view
  29. >
  30. </picker>
  31. </view>
  32. </view>
  33. <view class="u-font28 u-999 u-flex-center-sb">
  34. <text class="u-mr10 iconfont u-02331F u-font30">手机号码</text>
  35. <input
  36. type="number"
  37. :value="phone"
  38. maxlength="11"
  39. @input="userMobile"
  40. placeholder="请输入"
  41. style="text-align: right;"
  42. />
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <view
  48. class=""
  49. v-for="(pitem, index) in sureDataAll.shop_orders"
  50. :key="pitem.source_shop_id"
  51. >
  52. <view class="shopList u-mt30">
  53. <ldshop
  54. :shopStatus="shopStatus"
  55. :value="pitem.source_shop_name"
  56. ></ldshop>
  57. <view v-for="item in pitem.items" :key="item.goods_id">
  58. <ldgoods :value="item" :zhe="false"></ldgoods>
  59. </view>
  60. </view>
  61. <!-- list -->
  62. <view class="listText u-mt30">
  63. <view class="u-border-one-one u-p30 u-flex-center-sb">
  64. <view class="u-font28 u-181818">
  65. <text>商品金额</text>
  66. </view>
  67. <view class="u-font30 u-999">
  68. ¥ {{ pitem.original_goods_amount }}
  69. </view>
  70. </view>
  71. <view class="u-border-one-one u-p30 u-flex-center-sb">
  72. <view class="u-font28 u-181818">
  73. <text>服务商品折扣</text>
  74. </view>
  75. <view class="u-font30 u-999"> -¥ {{ pitem.discount_amount }} </view>
  76. </view>
  77. <view class="u-border-one-one u-p30 u-flex-center-sb">
  78. <view class="u-font28 u-181818">
  79. <text>支付金额</text>
  80. </view>
  81. <view class="u-font30 u-FF0000 u-bold">
  82. <rich-text
  83. :nodes="$mUtil.priceBigSmall(pitem.total_amount)"
  84. ></rich-text>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- 备注 -->
  89. <view class="listText u-p30 u-mt30">
  90. <view class="u-font28 u-181818">填写备注</view>
  91. <textarea
  92. class="textarea u-mt10 u-font28 u-333"
  93. @input="textareaText($event, index)"
  94. value=""
  95. placeholder="如有需求请填写"
  96. />
  97. </view>
  98. </view>
  99. </view>
  100. <!-- 底部 -->
  101. <view class="botfixed u-flex-center-sb">
  102. <view class="leftAll u-flex-center">
  103. <view class="u-flex-center">
  104. <text class="u-font28 u-333">合计:</text>
  105. <view class="u-FF0000 u-bold">
  106. <rich-text
  107. :nodes="$mUtil.priceBigSmall(sureDataAll.total_money)"
  108. ></rich-text>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="rightP u-flex-center" @click="submitOrder">
  113. <view class="u-btn btnWidth u-ml30">提交订单</view>
  114. </view>
  115. </view>
  116. <!--页面加载动画-->
  117. <ldLoading isFullScreen :active="loading"></ldLoading>
  118. </view>
  119. </template>
  120. <script>
  121. var app = getApp();
  122. import ldshop from "../../../components/ld-shop/ld-shop.vue";
  123. import ldgoods from "../../../components/ld-goods/ld-goods.vue";
  124. export default {
  125. components: {
  126. ldshop,
  127. ldgoods,
  128. },
  129. data() {
  130. return {
  131. shopStatus: false,
  132. tabTop: 0,
  133. price: 20,
  134. loading: false,
  135. status: 1, //快递方式标志
  136. config: {
  137. back: true, //false是tolbar页面 是则不写
  138. title: "订单详情",
  139. color: "#1a1a1a",
  140. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  141. backgroundColor: [1, "#fff"],
  142. statusBarFontColor: "#fff",
  143. },
  144. sureDataAll: {},
  145. shopDiscounts: {},
  146. self_take: {},
  147. dataJson: {},
  148. sureData: {},
  149. addressChose: false,
  150. platform: [
  151. {
  152. name: "保密",
  153. },
  154. {
  155. name: "先生",
  156. },
  157. {
  158. name: "女士",
  159. },
  160. ],
  161. gender: null,
  162. index: 1,
  163. name: null,
  164. phone: null,
  165. type:null
  166. };
  167. },
  168. onLoad(options) {
  169. this.loading = true;
  170. this.tabTop = app.globalData.barHeight + 44;
  171. let dataJson = uni.getStorageSync("dataJson");
  172. let user=uni.getStorageSync("personal")
  173. if(user){
  174. this.phone=user.mobile
  175. }
  176. if(options.type){
  177. this.type=options.type
  178. }
  179. if (dataJson) {
  180. this.dataJson = dataJson;
  181. }
  182. },
  183. onShow() {
  184. let orderreminder =uni.getStorageSync("orderreminder")
  185. if(orderreminder){
  186. this.$mUtil.toast("已生成待付款订单")
  187. uni.removeStorageSync("orderreminder")
  188. }
  189. this.loading = false;
  190. let dataJson = uni.getStorageSync("dataJson");
  191. this.sureDataAll=dataJson
  192. if (dataJson && !this.addressChose) {
  193. this.loading = true;
  194. this.$http.post(`/order/build`, dataJson).then((res) => {
  195. if (res && res.code == 200) {
  196. this.loading = false;
  197. uni.setStorageSync("sureData", res.data);
  198. if (res.data) {
  199. this.sureDataAll = res.data;
  200. let totaltNum = 0;
  201. res.data.shop_orders.forEach((res) => {
  202. totaltNum += res.goods_num;
  203. });
  204. this.sureData = res.data;
  205. this.totaltNum = totaltNum;
  206. }
  207. }
  208. });
  209. }
  210. },
  211. methods: {
  212. bindPickerChange(e) {
  213. this.index = e.detail.value;
  214. },
  215. //提交订单
  216. submitOrder() {
  217. if (!this.name) {
  218. this.$mUtil.toast("请填写姓名");
  219. return false;
  220. }
  221. if (!this.phone) {
  222. this.$mUtil.toast("请填写手机号");
  223. return false;
  224. }
  225. if (!this.phone.match(this.$mConfig.telRegex)) {
  226. this.$mUtil.toast("请输入正确手机号");
  227. return false;
  228. }
  229. this.dataJson.service_contacts = {
  230. contacts: this.name,
  231. mobile: this.phone,
  232. gender: this.index
  233. };
  234. this.orderCreated();
  235. },
  236. orderCreated() {
  237. this.$http.post("/order/create", this.dataJson).then((res) => {
  238. this.loading = false;
  239. if (res && res.code == 200) {
  240. let target = res.data;
  241. if (target.payment_status == 5) {
  242. uni.reLaunch({
  243. url: "/pages/order/orderList/serviceOrder",
  244. });
  245. return false;
  246. } else {
  247. uni.navigateTo({
  248. url:
  249. "../../order/pay?id=" +
  250. target.id +
  251. "&total_amount=" +
  252. target.total_amount +
  253. "&expired_pay_time=" +
  254. target.expired_pay_time+'&type='+this.type
  255. });
  256. }
  257. }
  258. });
  259. },
  260. userName(e) {
  261. this.name = e.detail.value;
  262. },
  263. userMobile(e) {
  264. this.phone = e.detail.value;
  265. },
  266. textareaText(e, index) {
  267. this.dataJson.shop_orders.map((v, i) => {
  268. if (i == index) {
  269. v.user_remark = e.detail.value;
  270. }
  271. });
  272. },
  273. //店铺优惠查询
  274. getByShop(id) {
  275. this.$http.get("/marketing/firstOrder/getByShop/" + id).then((res) => {
  276. if (res && res.code == 200) {
  277. this.shopDiscounts = res.data;
  278. }
  279. });
  280. },
  281. //选完地址回选
  282. otherFun(object) {
  283. this.addressChose = true;
  284. if (!!object) {
  285. let dataJson = uni.getStorageSync("dataJson");
  286. dataJson.receipt_id = object.addressid;
  287. this.dataJson = dataJson;
  288. this.postData(dataJson);
  289. }
  290. },
  291. postData(dataJson) {
  292. this.$http.post(`/order/build`, dataJson).then((res) => {
  293. if (res && res.code == 200) {
  294. uni.setStorageSync("sureData", res.data);
  295. this.sureDataAll = res.data;
  296. let totaltNum = 0;
  297. res.data.shop_orders.forEach((res) => {
  298. totaltNum += res.goods_num;
  299. });
  300. this.sureData = res.data;
  301. this.totaltNum = totaltNum;
  302. }
  303. });
  304. },
  305. changeStatus(val) {
  306. this.status = val;
  307. if (val == 1) {
  308. this.dataJson.shipment_mode = 0;
  309. } else {
  310. this.dataJson.shipment_mode = 1;
  311. }
  312. this.postData(this.dataJson);
  313. },
  314. },
  315. };
  316. </script>
  317. <style lang="scss" scoped>
  318. .goHome{
  319. /deep/ .uni-input-placeholder,/deep/ .uni-input-input{
  320. text-align: right;
  321. font-size: 30rpx;
  322. }
  323. .sex{
  324. color: #02331F;
  325. }
  326. }
  327. </style>
  328. <style lang="scss">
  329. page {
  330. background-color: #f5f5f5;
  331. }
  332. .textarea {
  333. width: 100%;
  334. height: 160rpx;
  335. }
  336. .topStatus {
  337. height: 100rpx;
  338. background-color: #fff;
  339. position: fixed;
  340. z-index: 9;
  341. width: 100%;
  342. box-sizing: border-box;
  343. text {
  344. line-height: 100rpx;
  345. position: relative;
  346. }
  347. .active {
  348. font-weight: bold;
  349. color: #0B844A;
  350. }
  351. .active:after {
  352. width: 100%;
  353. height: 2px;
  354. background-color: #0B844A;
  355. content: "";
  356. position: absolute;
  357. bottom: 0;
  358. left: 0;
  359. }
  360. }
  361. .courierAddress {
  362. background-color: #fff;
  363. padding: 36rpx 30rpx;
  364. }
  365. .goHome,
  366. .listText {
  367. background-color: #fff;
  368. }
  369. .btnview {
  370. width: 300rpx;
  371. margin: 30rpx auto 0;
  372. }
  373. .carbox {
  374. padding: 0rpx 0 160rpx 0;
  375. .shopList {
  376. background-color: #fff;
  377. padding: 30rpx 30rpx 0;
  378. }
  379. }
  380. .changeTabtwo {
  381. padding: 130rpx 0 160rpx 0;
  382. }
  383. .rightText {
  384. justify-content: space-between;
  385. height: 200rpx;
  386. }
  387. .bottext,
  388. .botPrice {
  389. width: 100%;
  390. }
  391. .bottext {
  392. margin-top: 36rpx;
  393. }
  394. .rightAddRes {
  395. width: 172rpx;
  396. height: 50rpx;
  397. border-radius: 8rpx;
  398. border: 1px solid #e5e5e5;
  399. .centertext {
  400. text-align: center;
  401. }
  402. .btnTag {
  403. width: 50rpx;
  404. height: 50rpx;
  405. line-height: 50rpx;
  406. text-align: center;
  407. background-color: #dedede;
  408. font-size: 46rpx;
  409. color: #888;
  410. }
  411. }
  412. .btnWidth {
  413. width: 340rpx;
  414. background: #0B844A;
  415. }
  416. .botfixed {
  417. position: fixed;
  418. background-color: #fff;
  419. width: 100%;
  420. height: 138rpx;
  421. bottom: 0;
  422. left: 0;
  423. z-index: 9;
  424. padding: 0 30rpx;
  425. box-sizing: border-box;
  426. }
  427. </style>