pointsDetails.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view style="padding-top: 0.01rpx;">
  3. <view style="width: 100%;margin: 0 auto;height: 800rpx;">
  4. <!-- <image v-for="(ite,ind) in form.filesList" :key="ind" v-if="ite.version === '0'" :src="ite.url" style="width: 100%;height: 100%;border-radius: 20rpx;"></image> -->
  5. <u-swiper :list="form.filesList" indicator indicatorMode="dot"
  6. :autoplay="false" height="800rpx" @click="swiperclick"></u-swiper>
  7. </view>
  8. <view class="contentBox">
  9. <view style="display: flex;align-items: center;">
  10. <view>
  11. <text style="font-size: 58rpx;color: red;margin-right: 20rpx;">¥{{checkStatus == '通过'?form.mallPrice || 0:'***'}}</text>
  12. <!-- <text style="font-size: 48rpx;text-decoration:line-through;">¥{{form.standardPrice}}</text> -->
  13. </view>
  14. <view style="display: flex;">
  15. <view v-if="form.billType == 0"
  16. style="font-size: 16rpx;background-color: #E75F37;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  17. 今日达</view>
  18. <view v-else
  19. style="font-size: 16rpx;background-color: #5ac725;color: #fff;padding: 6rpx;border-radius: 6rpx;">
  20. 次日达</view>
  21. </view>
  22. </view>
  23. <view>
  24. <text>{{form.cname}}</text>
  25. </view>
  26. </view>
  27. <view class="head">
  28. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  29. <u-cell :isLink="false" :border="false" center>
  30. <template slot="title">
  31. <u-radio-group
  32. v-model="dataForm.type"
  33. placement="row"
  34. @change="groupChange">
  35. <u-radio activeColor="#E75F37" v-if="dataForm.thisLocality"
  36. :label="`今日达(库存:${~~(dataForm.thisLocality.inventory) > 10?'充足':~~(dataForm.thisLocality.inventory)})`" :name="0"></u-radio>
  37. <u-radio activeColor="#E75F37" v-if="dataForm.offsite"
  38. :label="`次日达(库存:${~~(dataForm.offsite.inventory) > 10?'充足':~~(dataForm.offsite.inventory)})`" :name="1"></u-radio>
  39. </u-radio-group>
  40. </template>
  41. <template slot="value">
  42. <view>
  43. <u-icon :name="inventoryFalse?'arrow-up':'arrow-down'" @click="inventoryFalsefun()"></u-icon>
  44. </view>
  45. </template>
  46. </u-cell>
  47. </u-cell-group>
  48. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false" v-if="inventoryFalse">
  49. <u-cell v-for="(item,index) in inventoryData" :key="index"
  50. :title="item.storageName" :value="Number(item.storeInventory) > 10?'充足':Number(item.storeInventory)"></u-cell>
  51. </u-cell-group>
  52. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false">
  53. <!-- <u-cell title="所属公司:" :isLink="true" :border="false" center
  54. @click="filterAll(['salesCompanyName','salesCompanyId'])">
  55. <template slot="value">
  56. <text>{{form.salesCompanyName}}</text>
  57. </template>
  58. </u-cell> -->
  59. <u-cell :isLink="false" :border="false" center>
  60. <template slot="title">
  61. <!-- 一种利用符号进行的类型转换,转换成数字类型 -->
  62. <text>库存:{{form.inventory?~~(form.inventory) > 10?'充足':~~(form.inventory):''}}</text>
  63. </template>
  64. <template slot="value">
  65. <u-number-box v-model="form.goodsNum" :min="1" :max="form.inventory"></u-number-box>
  66. </template>
  67. </u-cell>
  68. </u-cell-group>
  69. </view>
  70. <view class="head">
  71. <u-cell-group title-bg-color="rgb(243, 244, 246)" :border="false" v-if="arrow">
  72. <u-cell :isLink="false" :border="false" center>
  73. <template slot="title">
  74. <text>规格型号:</text>
  75. </template>
  76. <template slot="value">
  77. <text>{{form.specificationAndModel||''}}</text>
  78. </template>
  79. </u-cell>
  80. <u-cell :isLink="false" :border="false" center>
  81. <template slot="title">
  82. <text>花纹:</text>
  83. </template>
  84. <template slot="value">
  85. <text>{{form.brandItem||''}}</text>
  86. </template>
  87. </u-cell>
  88. <u-cell :isLink="false" :border="false" center>
  89. <template slot="title">
  90. <text>产地:{{form.placeProduction||''}}</text>
  91. </template>
  92. <template slot="value">
  93. <text>防爆:{{form.explosionProof==1?"是":"否"}}</text>
  94. </template>
  95. </u-cell>
  96. <u-cell :isLink="false" :border="false" center>
  97. <template slot="title">
  98. <text>原厂:{{form.originalFactory==1?'是':'否'}}</text>
  99. </template>
  100. <template slot="value">
  101. <text>自修补:{{form.selfRecovery==1?'是':'否'}}</text>
  102. </template>
  103. </u-cell>
  104. </u-cell-group>
  105. <view style="margin: 0 auto;" @click="arrow = !arrow">
  106. <u-icon name="arrow-up" labelPos="top" size="28" v-if="arrow"></u-icon>
  107. <u-icon name="arrow-down" labelPos="top" size="28" v-else></u-icon>
  108. </view>
  109. </view>
  110. <u-divider text="商品详情"></u-divider>
  111. <view style="width: 100%;margin-bottom: 100rpx;">
  112. <view v-html="form.detailsText"></view>
  113. </view>
  114. <view style="width: 100%;position: fixed;bottom: 0;background-color: #fff;border-top: 1rpx solid #ccc;padding-bottom: env(safe-area-inset-bottom);">
  115. <view style="width: 100%;display: flex;font-size: 24rpx;">
  116. <view @click="shoppingCart"
  117. style="width: 25%;display: grid;justify-items: center;padding: 10rpx 0;border-right: 1rpx solid #ccc;">
  118. <u-icon name="shopping-cart"></u-icon>
  119. <view>总换记录</view>
  120. </view>
  121. <view @click="placeAnOrder" v-if="form.inventory > 0"
  122. style="width: 75%;background-color: #E75F37;display: grid;justify-items: center;">
  123. <u-icon name="checkmark" color="#fff"></u-icon>
  124. <view style="color: #fff;">立即兑换</view>
  125. </view>
  126. <view @click="soldOut" v-else
  127. style="width: 75%;background-color: #969696;display: grid;justify-items: center;">
  128. <u-icon name="close" color="#fff"></u-icon>
  129. <view style="color: #fff;">已售罄</view>
  130. </view>
  131. </view>
  132. </view>
  133. <u-picker :show="showWarehouse" :columns="columns" :keyName="keyName" @confirm="confirmWarehouse"
  134. @cancel="showWarehouse = false"></u-picker>
  135. <!-- 提取去登录 -->
  136. <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!'
  137. @confirm="adminConfirm"
  138. @cancel="adminShow = false" ></u-modal>
  139. </view>
  140. </template>
  141. <script>
  142. import {
  143. appDetail,
  144. addToCart,
  145. appModifyPrice,
  146. stockDescList,
  147. orderIntegralExchange
  148. } from '@/api/tabBar/home.js'
  149. export default {
  150. data() {
  151. return {
  152. checkboxValue:[],
  153. form: {
  154. shareList: []
  155. },
  156. arrow:false,
  157. dataList: [],
  158. screen: {},
  159. columns: [],
  160. keyName: '',
  161. showWarehouse: false,
  162. dataForm:{
  163. thisLocality:{},
  164. offsite:{}
  165. },
  166. inventoryFalse:false,
  167. inventoryData:[],
  168. // 审核状态
  169. checkStatus:'',
  170. adminShow:false,
  171. userInfo:{}, // 当前登录人信息
  172. }
  173. },
  174. onLoad(onLoad) {
  175. this.userInfo = uni.getStorageSync('userInfo')
  176. this.checkStatus = uni.getStorageSync('checkStatus');
  177. appDetail(onLoad).then(res => {
  178. this.dataForm = res.data
  179. if(res.data.type == 0){
  180. this.form = res.data.thisLocality
  181. }else{
  182. this.form = res.data.offsite
  183. }
  184. this.form.goodsNum = Number(this.form.goodsNum)
  185. })
  186. },
  187. methods: {
  188. // admin确认
  189. adminConfirm(){
  190. uni.clearStorageSync();
  191. uni.redirectTo({
  192. url: '/pages/login/login'
  193. })
  194. },
  195. // 轮播图点击预览
  196. swiperclick(e){
  197. let arr = this.form.filesList.map(item=>{
  198. return item.url
  199. })
  200. uni.previewImage({
  201. count:arr[e],
  202. current:e,
  203. urls:arr
  204. })
  205. },
  206. inventoryFalsefun(){
  207. this.inventoryFalse = !this.inventoryFalse
  208. this.stockDescListfun()
  209. },
  210. // 库存查询
  211. stockDescListfun(){
  212. stockDescList({
  213. cname:this.form.cname,
  214. whether:0
  215. }).then(res=>{
  216. this.inventoryData = res.data.records
  217. })
  218. },
  219. soldOut() {
  220. uni.showToast({
  221. icon: "none",
  222. title: '商品已售罄',
  223. mask: true
  224. });
  225. },
  226. backToHome() {
  227. uni.$u.route({
  228. url: 'pages/tabBar/home',
  229. type: "switchTab"
  230. })
  231. },
  232. // 加入购物车
  233. placeAnOrder() {
  234. if(uni.getStorageSync('userInfo').tenant_id == '000000') {
  235. this.adminShow = true
  236. return
  237. }
  238. uni.showLoading({
  239. title: '加载中',
  240. mask: true
  241. });
  242. orderIntegralExchange({
  243. ...this.form,
  244. bsType:'XS',
  245. detailsText: ''
  246. }).then(res => {
  247. uni.hideLoading();
  248. uni.showToast({
  249. title: "商品兑换成功",
  250. icon: "none",
  251. mask:true,
  252. duration:2500
  253. });
  254. }).catch(err => {
  255. uni.hideLoading();
  256. })
  257. },
  258. filterAll(screen) {
  259. this.screen = screen
  260. switch (screen[1]) {
  261. case "salesCompanyId":
  262. this.columns = [this.form.shareList]
  263. this.keyName = screen[1]
  264. this.showWarehouse = true
  265. break
  266. }
  267. },
  268. confirmWarehouse(e) {
  269. appModifyPrice({
  270. id: e.value[0].id
  271. }).then(res => {
  272. this.form.salesCompanyName = e.value[0].salesCompanyName
  273. this.form.salesCompanyId = e.value[0].salesCompanyId
  274. this.form.mallPrice = res.data.mallPrice
  275. this.form.inventory = res.data.inventory
  276. this.showWarehouse = false
  277. })
  278. },
  279. groupChange(val){
  280. console.log(val)
  281. if(val == 0){
  282. this.form = this.dataForm.thisLocality
  283. }else{
  284. this.form = this.dataForm.offsite
  285. }
  286. },
  287. shoppingCart() {
  288. uni.$u.route('/pages/tabBar/integralList/exchangeRecords');
  289. // uni.$u.route({
  290. // url: 'pages/tabBar/shoppingCart',
  291. // type: "switchTab"
  292. // })
  293. }
  294. }
  295. }
  296. </script>
  297. <style scoped>
  298. /* page {
  299. background-color: #f2f2f2 !important;
  300. } */
  301. .head {
  302. width: calc(96% - 40rpx);
  303. margin: 0 auto;
  304. background-color: #FFFFFF;
  305. margin-top: 20rpx;
  306. border-radius: 20rpx;
  307. padding: 10rpx 20rpx 10rpx 20rpx;
  308. }
  309. .contentBox {
  310. width: 96%;
  311. margin: 20rpx auto;
  312. background-color: #FFFFFF;
  313. border-radius: 20rpx;
  314. /* box-shadow: 0 5rpx 14rpx 0 rgba(101, 176, 249, 0.42); */
  315. padding-top: 15rpx;
  316. padding-bottom: 10rpx;
  317. }
  318. .textBox {
  319. padding: 0 15px;
  320. display: flex;
  321. justify-content: space-between;
  322. font-size: 24rpx;
  323. margin-bottom: 10rpx;
  324. align-items: flex-end;
  325. }
  326. </style>